XFree86 3.2r - xterm patch #36 - 1997/1/16 - T.Dickey
 
This corrects something that I overlooked in patch #27 (21-aug-1996), which is
that when trimming the region to be repainted for the highlightSelection
resource of xterm, I still have to paint the background past the highlighted
region.  This only happens when I first do a selection in a window that's
partly off-screen, then move the window on-screen.
 
--------------------------------------------------------------------------------
  screen.c |   15 +++++++++++----
 1 files changed, 11 insertions, 4 deletions
--------------------------------------------------------------------------------
 Index: screen.c
--- xterm-35+/screen.c  Wed Jan  8 18:18:35 1997
 +++ xterm-36/screen.c   Thu Jan 16 06:42:11 1997
 @@ -439,6 +439,7 @@
            register Char *attrs;
           register int col = leftcol;
           int maxcol = leftcol + ncols - 1;
+          int hi_col = maxcol;
            int lastind;
           int flags;
           int fg = 0, bg = 0;
@@ -506,10 +507,12 @@
                * apparent).
                */
               if (screen->highlight_selection
-               && maxcol >= screen->max_col
 -               && screen->send_mouse_pos != 3)
 -                  while (maxcol > 0 && !(attrs[maxcol] & CHARDRAWN))
 -                       maxcol--;
 +/*             && maxcol >= screen->max_col */
 +               && screen->send_mouse_pos != 3) {
 +                  hi_col = screen->max_col;
 +                  while (hi_col > 0 && !(attrs[hi_col] & CHARDRAWN))
 +                       hi_col--;
 +              }
  
               /* remaining piece should be hilited */
               hilite = True;
@@ -530,6 +533,7 @@
 
           for (; col <= maxcol; col++) {
                if ((attrs[col] != flags)
+                || (hilite && (col > hi_col))
  #if OPT_ISO_COLORS
                 || ((flags & FG_COLOR) && (extract_fg(fb[col],attrs[col]) != fg))
                 || ((flags & BG_COLOR) && (extract_bg(fb[col]) != bg))
@@ -541,6 +545,9 @@
                   x += (col - lastind) * FontWidth(screen);
 
                   lastind = col;
+
+                  if (hilite && (col > hi_col))
 +                       hilite = False;
  
                   flags = attrs[col];
                   if_OPT_ISO_COLORS(screen,{