diff options
| -rw-r--r-- | draw.c | 7 | ||||
| -rw-r--r-- | gramscii.1 | 4 | ||||
| -rw-r--r-- | gramscii.h | 3 | ||||
| -rw-r--r-- | screen.c | 2 | 
4 files changed, 14 insertions, 2 deletions
@@ -331,6 +331,13 @@ void visual_box(FILE *fc){  				modified = 1;  				goto vis_exit;  				break; +			case 'C':/* crop-to-region */ +				copy_lines_to_ring(0, HEIGHT-1, PRV_STATE); +				crop_to_rect(MIN(x, orig_x), MIN(y, orig_y), MAX(x, orig_x), MAX(y, orig_y)); +				copy_lines_to_ring(0, HEIGHT-1, NEW_STATE); +				modified = 1; +				goto vis_exit; +				break;  		}   		check_bound();  		set_video(VIDEO_NRM); @@ -384,6 +384,10 @@ subsequent yank/cut commands.  Fill region. gramscii will wait for a character on input and then will  fill the highlighted region with that character.  .TP 5m +.BI C +Crop-to-region. Crop the chart to the content of the highlighted region. +Everything else in the screen is erased. +.TP 5m  .BI v  leave   .B visual @@ -71,7 +71,7 @@ typedef struct{  #define progr_x(d) ((d) == DIR_L ? -1 : (d) == DIR_R ? 1 : 0)  #define progr_y(d) ((d) == DIR_U ? -1 : (d) == DIR_D ? 1 : 0) -#define DEBUG 1 +/** #define DEBUG 1 **/  /** global variables **/  @@ -139,6 +139,7 @@ void erase_line(int i);  void erase_screen();  void go_to(int where);  void crop_to_nonblank(); +void crop_to_rect();  void erase_blank_lines(int y1, int y2);  /** drawing-related functions **/ @@ -449,7 +449,7 @@ void crop_to_rect(int x1, int y1, int x2, int y2){  		sprintf(screen.l[i].s, "%s", screen.l[i+y1].s + x1);  		screen.l[i].lst = screen.l[i+y1].lst - x1;  	}  -	while (i<=y2){ +	while (i< HEIGHT){  		screen.l[i].lst = -1;  		screen.l[i].s[0]= '\0';  		i ++;  | 
