diff options
author | KatolaZ <katolaz@freaknet.org> | 2019-07-30 12:15:54 +0100 |
---|---|---|
committer | KatolaZ <katolaz@freaknet.org> | 2019-07-30 12:15:54 +0100 |
commit | eebc645dee0d15871d6cc46f156d424cd916b191 (patch) | |
tree | 82bb51d04d05a3cf1b4937e2cefb70cc282e9993 /draw.c | |
parent | a99759398841d86928c7ad4d8248f907765cbeb2 (diff) |
yank buffer and initial copy/cut/paste support
Diffstat (limited to 'draw.c')
-rw-r--r-- | draw.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -299,9 +299,15 @@ void visual_box(FILE *fc){ draw_box(x,y,NOFIX); while((c=fgetc(fc))!=EOF && c != 27 && c!= 'v' && c != '\n'){ if (!move_around(c, fc)) switch(c){ + case 'y': /* yank (copy) */ + yank_region(MIN(orig_x,x), MIN(orig_y,y), MAX(orig_x, x), MAX(orig_y, y)); + goto vis_exit; + break; case 'f':/* fill */ f = get_key(fc, "fill char: "); /** FALLTHROUGH **/ case 'x':/* erase */ + if (c == 'x') + yank_region(MIN(orig_x,x), MIN(orig_y,y), MAX(orig_x, x), MAX(orig_y, y)); erase_box(orig_x, orig_y, f); erase_blank_lines(MIN(y,orig_y), MAX(y, orig_y)); modified = 1; @@ -323,3 +329,8 @@ vis_exit: redraw(); mode = MOVE; } + +void paste(){ + paste_region(x, y); + redraw(); +} |