From f660595c236a21555d3558dd51afae4a67d651a3 Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Thu, 1 Aug 2019 09:56:13 +0100 Subject: add undo in arrow mode --- draw.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'draw.c') diff --git a/draw.c b/draw.c index ec44c2f..bc6657d 100644 --- a/draw.c +++ b/draw.c @@ -173,7 +173,7 @@ void draw_arrow(int x, int y, char *a, int a_len, int fix){ char line; void (*f)(int, int, char); - + a_miny = a_maxy = y; if (fix == FIX) f = set_xy; else @@ -198,6 +198,8 @@ void draw_arrow(int x, int y, char *a, int a_len, int fix){ line = (a[i] & DIR_L) || (a[i] & DIR_R) ? line_h : line_v; x += progr_x(a[i]); y += progr_y(a[i]); + if (y < a_miny) a_miny = y; + if (y > a_maxy) a_maxy = y; f(x, y, line); } /* f(x,y,mark_end);*/ @@ -250,8 +252,9 @@ update_arrow: show_cursor(); } if (c == 'a' || c == '\n'){ - invalidate_undo(); + copy_lines_to_ring(a_miny, a_maxy, PRV_STATE); draw_arrow(orig_x, orig_y, arrow, arrow_len, FIX); + copy_lines_to_ring(a_miny, a_maxy, NEW_STATE); modified = 1; } redraw(); -- cgit v1.2.3