ref: acbda0f5d4a5f3357037e44a2d1da8688d7c1735
parent: 832e7795358884e9d3ecd4fb85226933e38e9532
author: cancel <cancel@cancel.fm>
date: Fri Jan 3 20:36:23 EST 2020
Add bracketed paste setting selection area
--- a/tui_main.c
+++ b/tui_main.c
@@ -2498,7 +2498,8 @@
wtimeout(stdscr, 0);
int cur_timeout = 0;
Usz bracketed_paste_starting_x = 0, bracketed_paste_y = 0,
- bracketed_paste_x = 0;
+ bracketed_paste_x = 0, bracketed_paste_max_y = 0,
+ bracketed_paste_max_x = 0;
bool is_in_bracketed_paste = false;
// Send initial BPM
@@ -2861,6 +2862,12 @@
if (bracketed_paste_sequence_getch_ungetch(stdscr) ==
Bracketed_paste_sequence_end) {
is_in_bracketed_paste = false;
+ if (bracketed_paste_max_y > ged_state.ged_cursor.y)
+ ged_state.ged_cursor.h =
+ bracketed_paste_max_y - ged_state.ged_cursor.y + 1;
+ if (bracketed_paste_max_x > ged_state.ged_cursor.x)
+ ged_state.ged_cursor.w =
+ bracketed_paste_max_x - ged_state.ged_cursor.x + 1;
ged_state.needs_remarking = true;
ged_state.is_draw_dirty = true;
}
@@ -2883,6 +2890,13 @@
gbuffer_poke(ged_state.field.buffer, ged_state.field.height,
ged_state.field.width, bracketed_paste_y,
bracketed_paste_x, cleaned);
+ // Could move this out one level if we wanted the final selection
+ // size to reflect even the pasted area which didn't fit on the
+ // grid.
+ if (bracketed_paste_y > bracketed_paste_max_y)
+ bracketed_paste_max_y = bracketed_paste_y;
+ if (bracketed_paste_x > bracketed_paste_max_x)
+ bracketed_paste_max_x = bracketed_paste_x;
}
}
++bracketed_paste_x;
@@ -3030,6 +3044,8 @@
bracketed_paste_y = ged_state.ged_cursor.y;
bracketed_paste_x = ged_state.ged_cursor.x;
bracketed_paste_starting_x = bracketed_paste_x;
+ bracketed_paste_max_y = bracketed_paste_y;
+ bracketed_paste_max_x = bracketed_paste_x;
break;
}
ged_input_cmd(&ged_state, Ged_input_cmd_escape);