diff --git a/src/vte.c b/src/vte.c
index 8bee98f..fdedfc8 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -8117,7 +8117,7 @@ vte_terminal_screen_set_size(VteTerminal *terminal, VteScreen *screen, glong old
 	VteVisualPosition cursor_saved_absolute;
 	VteVisualPosition below_viewport;
 	VteVisualPosition below_current_paragraph;
-	VteVisualPosition *markers[5];
+	VteVisualPosition *markers[7];
 	gboolean was_scrolled_to_top = (screen->scroll_delta == _vte_ring_delta(ring));
 	gboolean was_scrolled_to_bottom = (screen->scroll_delta == screen->insert_delta);
 	glong old_top_lines;
@@ -8149,7 +8149,13 @@ vte_terminal_screen_set_size(VteTerminal *terminal, VteScreen *screen, glong old
 	markers[1] = &cursor_saved_absolute;
 	markers[2] = &below_viewport;
 	markers[3] = &below_current_paragraph;
-	markers[4] = NULL;
+	if (terminal->pvt->has_selection) {
+		markers[4] = &terminal->pvt->selection_start;
+		markers[5] = &terminal->pvt->selection_end;
+		markers[6] = NULL;
+	} else {
+		markers[4] = NULL;
+	}
 
 	old_top_lines = below_current_paragraph.row - screen->insert_delta;
 
