From d87cf8ea7ec68de924179eb1dbaa13f4b52bd1aa Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Sat, 20 Jul 2019 14:47:12 +0100 Subject: visual mode (erase and fill) --- TODO | 7 ++++--- gramscii.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index 2119199..c84da67 100644 --- a/TODO +++ b/TODO @@ -2,11 +2,12 @@ - (?) change cursor shape according to action - auto-arrow 'A' (automatic end-char) - read file at point -- visual selection ++ visual selection - crop - - fill - - delete - yank/put + * fill + * delete +- change screen management (i.e., use an array of lines) - undo (by storing lines changed across insert/remove operations) - manage special chars (DEL/CANC) during text insert (also do not print unmanaged chars!) diff --git a/gramscii.c b/gramscii.c index 8177d56..6676545 100644 --- a/gramscii.c +++ b/gramscii.c @@ -16,6 +16,7 @@ #define ARROW 0x02 #define TEXT 0x04 #define DEL 0x08 +#define VIS 0x10 #define DIR_N 0x00 #define DIR_R 0x01 @@ -45,6 +46,9 @@ #define END 0x02 #define MIDDLE 0x04 +#define VIDEO_NRM 0 +#define VIDEO_REV 7 + #define MIN(x,y) (x) < (y) ? (x) : (y) #define MAX(x,y) (x) > (y) ? (x) : (y) @@ -188,6 +192,21 @@ void erase_line(char *s){ } } +void erase_box(int x1, int y1, char c){ + + int x_incr, y_incr, i; + + x_incr = x1 < x? +1: -1; + y_incr = y1 < y? +1: -1; + do{ + i = y1; + do{ + set_xy(x1, i, c); + } while(i != y && (1 | (i += y_incr))); + } while(x1 != x && (1 | (x1 += x_incr))); + +} + void erase_screen(){ int i; for(i=0;i