summaryrefslogtreecommitdiff
path: root/draw.c
diff options
context:
space:
mode:
Diffstat (limited to 'draw.c')
-rw-r--r--draw.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/draw.c b/draw.c
index bc6657d..ae90458 100644
--- a/draw.c
+++ b/draw.c
@@ -168,7 +168,6 @@ update_box:
void draw_arrow(int x, int y, char *a, int a_len, int fix){
- /* FIXME: copy affected lines to undo */
int i, j, cur_dir;
char line;
void (*f)(int, int, char);
@@ -285,13 +284,24 @@ void erase(FILE *fc){
/*FIXME: add affected lines to undo */
char c;
int orig_x = x, orig_y = y;
+ char first = 1, opened = 0;
status_bar();
show_cursor();
- invalidate_undo();
while((c=fgetc(fc))!=EOF && c!=27 && c!= 'x' && c != '\n'){
if (!move_around(c, fc)) continue;
check_bound();
+ if (first ||
+ (y != orig_y && ! opened) ||
+ (y == orig_y && x != orig_x && !opened) ){
+ copy_lines_to_ring(MIN(y, orig_y), MAX(y, orig_y), PRV_STATE);
+ first = 0;
+ opened = 1;
+ }
do_erase(orig_x, orig_y);
+ if (y != orig_y && opened){
+ copy_lines_to_ring(MIN(y, orig_y), MAX(y, orig_y), NEW_STATE);
+ opened = 0;
+ }
step = 1;
modified = 1;
orig_x = x;
@@ -300,6 +310,8 @@ void erase(FILE *fc){
status_bar();
show_cursor();
}
+ if (opened)
+ copy_lines_to_ring(y, y, NEW_STATE);
mode = MOVE;
}