Index: vte3-0.34.6/src/vte.c
===================================================================
--- vte3-0.34.6.orig/src/vte.c	2013-09-17 12:57:27.000000000 +0400
+++ vte3-0.34.6/src/vte.c	2013-09-18 11:37:48.936095000 +0400
@@ -8043,12 +8043,16 @@
 	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);
+		}else
+		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));
 		}
 		gtk_widget_queue_resize_no_redraw (&terminal->widget);
 		/* Our visible text changed. */
