@@ -0,0 +1,67 @@
1+Index: vte-0.26.0/src/vte.c
2+===================================================================
3+--- vte-0.26.0.orig/src/vte.c 2010-11-30 23:04:53.000000000 -0800
4++++ vte-0.26.0/src/vte.c 2010-12-07 20:05:07.865548000 -0800
5+@@ -3862,6 +3862,7 @@ vte_terminal_process_incoming(VteTermina
6+ long wcount, start, delta;
7+ gboolean leftovers, modified, bottom, again;
8+ gboolean invalidated_text;
9++ gboolean in_scroll_region;
10+ GArray *unichars;
11+ struct _vte_incoming_chunk *chunk, *next_chunk, *achunk = NULL;
12+
13+@@ -3881,6 +3882,10 @@ vte_terminal_process_incoming(VteTermina
14+ cursor = screen->cursor_current;
15+ cursor_visible = terminal->pvt->cursor_visible;
16+
17++ in_scroll_region = screen->scrolling_restricted
18++ && (screen->cursor_current.row >= (screen->insert_delta + screen->scrolling_region.start))
19++ && (screen->cursor_current.row <= (screen->insert_delta + screen->scrolling_region.end));
20++
21+ /* We should only be called when there's data to process. */
22+ g_assert(terminal->pvt->incoming ||
23+ (terminal->pvt->pending->len > 0));
24+@@ -3979,6 +3984,8 @@ skip_chunk:
25+ * points to the first character which isn't part of this
26+ * sequence. */
27+ if ((match != NULL) && (match[0] != '\0')) {
28++ gboolean new_in_scroll_region;
29++
30+ /* Call the right sequence handler for the requested
31+ * behavior. */
32+ _vte_terminal_handle_sequence(terminal,
33+@@ -3989,12 +3996,20 @@ skip_chunk:
34+ start = (next - wbuf);
35+ modified = TRUE;
36+
37+- /* if we have moved during the sequence handler, restart the bbox */
38++ new_in_scroll_region = screen->scrolling_restricted
39++ && (screen->cursor_current.row >= (screen->insert_delta + screen->scrolling_region.start))
40++ && (screen->cursor_current.row <= (screen->insert_delta + screen->scrolling_region.end));
41++
42++ delta = screen->scroll_delta; /* delta may have changed from sequence. */
43++
44++ /* if we have moved greatly during the sequence handler, or moved into a scroll_region
45++ * from outside it, restart the bbox */
46+ if (invalidated_text &&
47+- (screen->cursor_current.col > bbox_bottomright.x + VTE_CELL_BBOX_SLACK ||
48+- screen->cursor_current.col < bbox_topleft.x - VTE_CELL_BBOX_SLACK ||
49+- screen->cursor_current.row > bbox_bottomright.y + VTE_CELL_BBOX_SLACK ||
50+- screen->cursor_current.row < bbox_topleft.y - VTE_CELL_BBOX_SLACK)) {
51++ ((new_in_scroll_region && !in_scroll_region) ||
52++ (screen->cursor_current.col > bbox_bottomright.x + VTE_CELL_BBOX_SLACK ||
53++ screen->cursor_current.col < bbox_topleft.x - VTE_CELL_BBOX_SLACK ||
54++ screen->cursor_current.row > bbox_bottomright.y + VTE_CELL_BBOX_SLACK ||
55++ screen->cursor_current.row < bbox_topleft.y - VTE_CELL_BBOX_SLACK))) {
56+ /* Clip off any part of the box which isn't already on-screen. */
57+ bbox_topleft.x = MAX(bbox_topleft.x, 0);
58+ bbox_topleft.y = MAX(bbox_topleft.y, delta);
59+@@ -4014,6 +4029,8 @@ skip_chunk:
60+ bbox_bottomright.x = bbox_bottomright.y = -G_MAXINT;
61+ bbox_topleft.x = bbox_topleft.y = G_MAXINT;
62+ }
63++
64++ in_scroll_region = new_in_scroll_region;
65+ } else
66+ /* Second, we have a NULL match, and next points to the very
67+ * next character in the buffer. Insert the character which