From 526ce3a130732d4a2374a6e36a689d9e0cf5cc34 Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Wed, 31 Jul 2019 00:10:35 +0100 Subject: preliminary support for undo --- gramscii.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'gramscii.h') diff --git a/gramscii.h b/gramscii.h index a08d211..73b9db7 100644 --- a/gramscii.h +++ b/gramscii.h @@ -44,6 +44,9 @@ #define VIDEO_NRM 0 #define VIDEO_REV 7 +#define CUR 0x01 +#define LST 0x02 + /** types **/ typedef struct{ @@ -59,6 +62,7 @@ typedef struct{ line_t *l; } lineset_t; + /** MACROS **/ #define MIN(x,y) (x) < (y) ? (x) : (y) @@ -73,6 +77,11 @@ typedef struct{ lineset_t screen; lineset_t cutbuf; +lineset_t *undo; + +int undo_sz; +int undo_cur; +int undo_lst; int WIDTH, HEIGHT; @@ -155,6 +164,8 @@ void ensure_line_length(line_t *l, int len); void ensure_num_lines(lineset_t *ls, int n); void yank_region(int x1, int y1, int x2, int y2); void paste_region(int x1, int y1); - +void copy_lines_to_ring(int y1, int y2, int which); +void undo_change(); +void redo_change(); #endif -- cgit v1.2.3