summaryrefslogtreecommitdiff
path: root/draw.c
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2019-07-31 11:49:06 +0100
committerKatolaZ <katolaz@freaknet.org>2019-07-31 11:49:06 +0100
commit7f6e62f77bca73e49dfa260ff7ac75770d1363c8 (patch)
tree849cf803a7e804ab879d41e161b69daf22987090 /draw.c
parentf3100ddd486d6f39b0c97c9c492bb6020bf3caf1 (diff)
support line-by-line undo in text mode
Diffstat (limited to 'draw.c')
-rw-r--r--draw.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/draw.c b/draw.c
index e4c3250..1e73719 100644
--- a/draw.c
+++ b/draw.c
@@ -77,10 +77,13 @@ void get_text(FILE *fc){
int orig_x = x;
redraw();
+ copy_lines_to_ring(y, y, PRV_STATE);
while((c=fgetc(fc))!=EOF && c != 27){
if(c=='\n'){
set_cur(BG);
+ copy_lines_to_ring(y,y, NEW_STATE);
y += 1;
+ copy_lines_to_ring(y, y, PRV_STATE);
x = orig_x;
}
else {
@@ -95,6 +98,8 @@ void get_text(FILE *fc){
status_bar();
show_cursor();
}
+ if (modified)
+ copy_lines_to_ring(y, y, NEW_STATE);
mode=MOVE;
}
@@ -245,6 +250,7 @@ update_arrow:
show_cursor();
}
if (c == 'a' || c == '\n'){
+ invalidate_undo();
draw_arrow(orig_x, orig_y, arrow, arrow_len, FIX);
modified = 1;
}
@@ -278,6 +284,7 @@ void erase(FILE *fc){
int orig_x = x, orig_y = y;
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();