--- a/src/vte.c
+++ b/src/vte.c
@@ -8069,9 +8069,10 @@
 	if (old_rows != terminal->row_count || old_columns != terminal->column_count) {
 		VteScreen *screen = terminal->pvt->screen;
 		glong visible_rows = MIN (old_rows, _vte_ring_length (screen->row_data));
-		if (terminal->row_count < visible_rows) {
-			glong delta = visible_rows - terminal->row_count;
-			screen->insert_delta += delta;
+		glong ring_length=_vte_ring_length (screen->row_data);
+		glong delta = visible_rows - terminal->row_count;
+		if (screen->cursor_current.row+delta>(ring_length-1) && terminal->row_count < visible_rows) {
+			screen->insert_delta += (screen->cursor_current.row+delta-(ring_length-1));
 			vte_terminal_queue_adjustment_value_changed (
 					terminal,
 					screen->scroll_delta + delta);
