diff options
| author | KatolaZ <katolaz@freaknet.org> | 2019-07-22 15:34:03 +0100 | 
|---|---|---|
| committer | KatolaZ <katolaz@freaknet.org> | 2019-07-22 15:34:03 +0100 | 
| commit | 0325743daff41b74466fb198eee5774d0c2ac004 (patch) | |
| tree | 0cf6f3da248f2f13af8e02d7cc5e75471b3713ea | |
| parent | 0c2294582b16427c87114418b9f154588dc641e0 (diff) | |
allow [ENTER] in box, arrow, erase, and visual mode
| -rw-r--r-- | TODO | 3 | ||||
| -rw-r--r-- | gramscii.1 | 29 | ||||
| -rw-r--r-- | gramscii.c | 12 | 
3 files changed, 31 insertions, 13 deletions
| @@ -4,7 +4,6 @@  - change screen management (i.e., dynamic array of lines)  - get screen geometry  - add action multiplier (e.g., "7h" moves left by 7 cols) -- use [ENTER] to confirm arrow, boxes, and text (useful for scripting)  - add scripting mode option ("-s"?)  - add screen geometry option (-g 25x80?)  - read file at point @@ -22,6 +21,8 @@    (also do not print unmanaged chars!)  - allow scrolling (both vertical and horizontal)  - auto-arrow 'A' (automatic end-char) +* allow the use of [ENTER] to confirm arrow, boxes, and text (useful +  for scripting)  * change "g" command:    - g-g (goto top-left)    - g-G (goto bottom-right) @@ -103,7 +103,7 @@ which will move in the corresponding direction by 5 units at a time.  Initiate a global positioning command (go). These are two-letter  commands starting with a  .BI g -and followed by a direction command or by a letter that indicates a +and followed by a direction command or by a character that indicates a  global position, namely:  .RS  .TP 5m @@ -147,9 +147,11 @@ is equivalent to  (or  .B gjgl  ). -Typing any other character after the first  +.PP +Typing   .BI g -aborts the global positioning command. +followed by any character that is not listed above has no effect on the +cursor.  .RE  .SS MODES @@ -181,7 +183,9 @@ mode identify a rectangular box (see  MOVEMENTS  above). When you are happy with the shape of your box, just press   .B b -again to have your box drawn and come back to +again or  +.B [ENTER] +to draw the current box permanently and get back to  .B move  mode. The horizontal and vertical borders of the box are drawn using  the current @@ -205,7 +209,9 @@ mode. All movements in  .B arrow  mode change the position of the end-point of the current arrow. Press  .BI a -again to draw the current arrow and come back to +again or  +.B [ENTER] +to draw the current arrow and come back to  .B move  mode. If you press   .B [ESC] @@ -237,7 +243,9 @@ while in  .BI erase  mode, the current erase operation is aborted. Press   .B x -again to make the erase permanent and return to +again or  +.B [ENTER] +to make the erase permanent and return to  .B move  mode.  .TP 7m @@ -288,6 +296,15 @@ mode and get back to  .B move  mode.  .TP 5m +.BI [ENTER] +same as  +.BI v, +i.e., leave  +.B visual +mode and get back to  +.B move +mode. +.TP 5m  .BI [ESC]  same as   .BI v, @@ -485,7 +485,7 @@ void get_box(){  	redraw();  	step = 1;  	draw_box(x,y,NOFIX); -	while((c=getchar())!=EOF && c != 27 && c!= 'b'){ +	while((c=getchar())!=EOF && c != 27 && c!= 'b' && c != '\n'){  		if (change_style(c))  			goto update_box;  		if (!move_around(c))  @@ -498,7 +498,7 @@ update_box:  		status_bar();  		show_cursor();  	} -	if (c == 'b'){ +	if (c == 'b' || c == '\n'){  		draw_box(orig_x, orig_y, FIX);  		modified = 1;  	} @@ -563,7 +563,7 @@ void get_arrow(){  	redraw();  	step = 1;  	draw_arrow(x,y, arrow, 0, NOFIX); -	while((c=getchar())!=EOF && c != 27 && c!= 'a'){ +	while((c=getchar())!=EOF && c != 27 && c!= 'a' && c != '\n'){  		if (change_style(c))  			goto update_arrow;  		if (!move_around(c)) @@ -583,7 +583,7 @@ update_arrow:  		status_bar();  		show_cursor();  	} -	if (c == 'a'){ +	if (c == 'a' || c == '\n'){  		draw_arrow(orig_x, orig_y, arrow, arrow_len, FIX);  		modified = 1;  	} @@ -616,7 +616,7 @@ void delete(){  	int orig_x = x, orig_y = y;  	status_bar();  	show_cursor(); -	while((c=getchar())!=EOF && c!=27 && c!= 'x'){ +	while((c=getchar())!=EOF && c!=27 && c!= 'x' && c != '\n'){  		if (!move_around(c)) continue;  		check_bound();  		do_delete(orig_x, orig_y); @@ -710,7 +710,7 @@ void visual_box(){  	step = 1;  	set_video(VIDEO_REV);  	draw_box(x,y,NOFIX); -	while((c=getchar())!=EOF && c != 27 && c!= 'v'){ +	while((c=getchar())!=EOF && c != 27 && c!= 'v' && c != '\n'){  		if (!move_around(c)) switch(c){  			case 'f':/* fill */  				f = get_key("fill char: "); /** FALLTHROUGH **/ | 
