diff --git a/render.c b/render.c index 9c701000..2aba3237 100644 --- a/render.c +++ b/render.c @@ -3976,6 +3976,7 @@ maybe_resize(struct terminal *term, int width, int height, bool force) term->interactive_resizing.old_hide_cursor = term->hide_cursor; term->interactive_resizing.grid = xmalloc(sizeof(*term->interactive_resizing.grid)); *term->interactive_resizing.grid = term->normal; + term->interactive_resizing.selection_coords = term->selection.coords; } else { /* We’ll replace the current temporary grid, with a new * one (again based on the original grid) */ @@ -4013,6 +4014,9 @@ maybe_resize(struct terminal *term, int width, int height, bool force) .kitty_kbd = orig->kitty_kbd, }; + term->selection.coords.start.row -= orig->view; + term->selection.coords.end.row -= orig->view; + for (size_t i = 0, j = orig->view; i < term->interactive_resizing.old_screen_rows; i++, j = (j + 1) & (orig->num_rows - 1)) @@ -4069,6 +4073,7 @@ maybe_resize(struct terminal *term, int width, int height, bool force) free(term->interactive_resizing.grid); term->hide_cursor = term->interactive_resizing.old_hide_cursor; + term->selection.coords = term->interactive_resizing.selection_coords; old_rows = term->interactive_resizing.old_screen_rows; @@ -4076,6 +4081,7 @@ maybe_resize(struct terminal *term, int width, int height, bool force) term->interactive_resizing.old_screen_rows = 0; term->interactive_resizing.new_rows = 0; term->interactive_resizing.old_hide_cursor = false; + term->interactive_resizing.selection_coords = (struct range){{-1, -1}, {-1, -1}}; term_ptmx_resume(term); } diff --git a/terminal.h b/terminal.h index ec5560cd..21236797 100644 --- a/terminal.h +++ b/terminal.h @@ -604,6 +604,7 @@ struct terminal { int old_cols; /* term->cols before resize started */ int old_hide_cursor; /* term->hide_cursor before resize started */ int new_rows; /* New number of scrollback rows */ + struct range selection_coords; } interactive_resizing; struct {