summaryrefslogtreecommitdiff
path: root/vte/vte-0.28.2-repaint-after-change-scroll-region.patch
blob: 86e547103ad7ca0a278b2e296c405f48faef7a2f (plain)
    1 https://git.gnome.org/browse/vte/commit/?id=88e8e89560a62d0981ce2b18974a230d0a07dbdd
    2 
    3 From 88e8e89560a62d0981ce2b18974a230d0a07dbdd Mon Sep 17 00:00:00 2001
    4 From: Micah Cowan <micah@cowan.name>
    5 Date: Tue, 22 Oct 2013 23:30:43 +0200
    6 Subject: widget: Fix invalidation region
    7 
    8 When the sequence handler moves the cursor into the restricted scrolling region,
    9 the bbox needs to be reset, too.
   10 Fixes glitches with interspersing writes to the bottom line with scrolls of the
   11 upper region, and also fixes missing screen redraws when using mosh.
   12 
   13 https://bugzilla.gnome.org/show_bug.cgi?id=542087
   14 https://bugzilla.gnome.org/show_bug.cgi?id=686097
   15 
   16 diff --git a/src/vte.c b/src/vte.c
   17 index 9f6d7d8..a4d9d25 100644
   18 --- a/src/vte.c
   19 +++ b/src/vte.c
   20 @@ -4077,6 +4077,7 @@ vte_terminal_process_incoming(VteTerminal *terminal)
   21  	long wcount, start, delta;
   22  	gboolean leftovers, modified, bottom, again;
   23  	gboolean invalidated_text;
   24 +	gboolean in_scroll_region;
   25  	GArray *unichars;
   26  	struct _vte_incoming_chunk *chunk, *next_chunk, *achunk = NULL;
   27  
   28 @@ -4096,6 +4097,10 @@ vte_terminal_process_incoming(VteTerminal *terminal)
   29  	cursor = screen->cursor_current;
   30  	cursor_visible = terminal->pvt->cursor_visible;
   31  
   32 +	in_scroll_region = screen->scrolling_restricted
   33 +	    && (screen->cursor_current.row >= (screen->insert_delta + screen->scrolling_region.start))
   34 +	    && (screen->cursor_current.row <= (screen->insert_delta + screen->scrolling_region.end));
   35 +
   36  	/* We should only be called when there's data to process. */
   37  	g_assert(terminal->pvt->incoming ||
   38  		 (terminal->pvt->pending->len > 0));
   39 @@ -4194,6 +4199,8 @@ skip_chunk:
   40  		 * points to the first character which isn't part of this
   41  		 * sequence. */
   42  		if ((match != NULL) && (match[0] != '\0')) {
   43 +			gboolean new_in_scroll_region;
   44 +
   45  			/* Call the right sequence handler for the requested
   46  			 * behavior. */
   47  			_vte_terminal_handle_sequence(terminal,
   48 @@ -4204,12 +4211,21 @@ skip_chunk:
   49  			start = (next - wbuf);
   50  			modified = TRUE;
   51  
   52 -			/* if we have moved during the sequence handler, restart the bbox */
   53 +			new_in_scroll_region = screen->scrolling_restricted
   54 +			    && (screen->cursor_current.row >= (screen->insert_delta + screen->scrolling_region.start))
   55 +			    && (screen->cursor_current.row <= (screen->insert_delta + screen->scrolling_region.end));
   56 +
   57 +			delta = screen->scroll_delta;	/* delta may have changed from sequence. */
   58 +
   59 +			/* if we have moved greatly during the sequence handler, or moved
   60 +                         * into a scroll_region from outside it, restart the bbox.
   61 +                         */
   62  			if (invalidated_text &&
   63 -					(screen->cursor_current.col > bbox_bottomright.x + VTE_CELL_BBOX_SLACK ||
   64 -					 screen->cursor_current.col < bbox_topleft.x - VTE_CELL_BBOX_SLACK     ||
   65 -					 screen->cursor_current.row > bbox_bottomright.y + VTE_CELL_BBOX_SLACK ||
   66 -					 screen->cursor_current.row < bbox_topleft.y - VTE_CELL_BBOX_SLACK)) {
   67 +					((new_in_scroll_region && !in_scroll_region) ||
   68 +					 (screen->cursor_current.col > bbox_bottomright.x + VTE_CELL_BBOX_SLACK ||
   69 +					  screen->cursor_current.col < bbox_topleft.x - VTE_CELL_BBOX_SLACK     ||
   70 +					  screen->cursor_current.row > bbox_bottomright.y + VTE_CELL_BBOX_SLACK ||
   71 +					  screen->cursor_current.row < bbox_topleft.y - VTE_CELL_BBOX_SLACK))) {
   72  				/* Clip off any part of the box which isn't already on-screen. */
   73  				bbox_topleft.x = MAX(bbox_topleft.x, 0);
   74  				bbox_topleft.y = MAX(bbox_topleft.y, delta);
   75 @@ -4229,6 +4245,8 @@ skip_chunk:
   76  				bbox_bottomright.x = bbox_bottomright.y = -G_MAXINT;
   77  				bbox_topleft.x = bbox_topleft.y = G_MAXINT;
   78  			}
   79 +
   80 +			in_scroll_region = new_in_scroll_region;
   81  		} else
   82  		/* Second, we have a NULL match, and next points to the very
   83  		 * next character in the buffer.  Insert the character which
   84 -- 
   85 cgit v0.10.2

Generated by cgit