99b86a7
To: vim-dev@vim.org
99b86a7
Subject: Patch 7.1.152
99b86a7
Fcc: outbox
99b86a7
From: Bram Moolenaar <Bram@moolenaar.net>
99b86a7
Mime-Version: 1.0
99b86a7
Content-Type: text/plain; charset=ISO-8859-1
99b86a7
Content-Transfer-Encoding: 8bit
99b86a7
------------
99b86a7
99b86a7
Patch 7.1.152
99b86a7
Problem:    Display problem when 'hls' and 'cursorcolumn' are set and
99b86a7
	    searching for "$".  (John Mullin)  Also when scrolling
99b86a7
	    horizontally when 'wrap' is off.
99b86a7
Solution:   Keep track of the column where highlighting was set.  Check the
99b86a7
	    column offset when skipping characters.
99b86a7
Files:	    src/screen.c
99b86a7
99b86a7
99b86a7
*** ../vim-7.1.151/src/screen.c	Mon Sep 17 22:37:05 2007
99b86a7
--- src/screen.c	Fri Oct 19 15:18:49 2007
99b86a7
***************
99b86a7
*** 2599,2604 ****
99b86a7
--- 2599,2605 ----
99b86a7
      int		syntax_attr = 0;	/* attributes desired by syntax */
99b86a7
      int		has_syntax = FALSE;	/* this buffer has syntax highl. */
99b86a7
      int		save_did_emsg;
99b86a7
+     int		eol_hl_off = 0;		/* 1 if highlighted char after EOL */
99b86a7
  #endif
99b86a7
  #ifdef FEAT_SPELL
99b86a7
      int		has_spell = FALSE;	/* this buffer has spell checking */
99b86a7
***************
99b86a7
*** 4312,4317 ****
99b86a7
--- 4313,4322 ----
99b86a7
  	{
99b86a7
  #ifdef FEAT_SEARCH_EXTRA
99b86a7
  	    long prevcol = (long)(ptr - line) - (c == NUL);
99b86a7
+ 
99b86a7
+ 	    /* we're not really at that column when skipping some text */
99b86a7
+ 	    if ((wp->w_p_wrap ? wp->w_skipcol : wp->w_leftcol) > prevcol)
99b86a7
+ 		++prevcol;
99b86a7
  #endif
99b86a7
  
99b86a7
  	    /* invert at least one char, used for Visual and empty line or
99b86a7
***************
99b86a7
*** 4408,4418 ****
99b86a7
--- 4413,4432 ----
99b86a7
  		ScreenAttrs[off] = char_attr;
99b86a7
  #ifdef FEAT_RIGHTLEFT
99b86a7
  		if (wp->w_p_rl)
99b86a7
+ 		{
99b86a7
  		    --col;
99b86a7
+ 		    --off;
99b86a7
+ 		}
99b86a7
  		else
99b86a7
  #endif
99b86a7
+ 		{
99b86a7
  		    ++col;
99b86a7
+ 		    ++off;
99b86a7
+ 		}
99b86a7
  		++vcol;
99b86a7
+ #ifdef FEAT_SYN_HL
99b86a7
+ 		eol_hl_off = 1;
99b86a7
+ #endif
99b86a7
  	    }
99b86a7
  	}
99b86a7
  
99b86a7
***************
99b86a7
*** 4422,4427 ****
99b86a7
--- 4436,4449 ----
99b86a7
  	if (c == NUL)
99b86a7
  	{
99b86a7
  #ifdef FEAT_SYN_HL
99b86a7
+ 	    if (eol_hl_off > 0 && vcol - eol_hl_off == (long)wp->w_virtcol)
99b86a7
+ 	    {
99b86a7
+ 		/* highlight last char after line */
99b86a7
+ 		--col;
99b86a7
+ 		--off;
99b86a7
+ 		--vcol;
99b86a7
+ 	    }
99b86a7
+ 
99b86a7
  	    /* Highlight 'cursorcolumn' past end of the line. */
99b86a7
  	    if (wp->w_p_wrap)
99b86a7
  		v = wp->w_skipcol;
99b86a7
***************
99b86a7
*** 4432,4438 ****
99b86a7
  
99b86a7
  		vcol = v + col - win_col_off(wp);
99b86a7
  	    if (wp->w_p_cuc
99b86a7
! 		    && (int)wp->w_virtcol >= vcol
99b86a7
  		    && (int)wp->w_virtcol < W_WIDTH(wp) * (row - startrow + 1)
99b86a7
  									   + v
99b86a7
  		    && lnum != wp->w_cursor.lnum
99b86a7
--- 4454,4460 ----
99b86a7
  
99b86a7
  		vcol = v + col - win_col_off(wp);
99b86a7
  	    if (wp->w_p_cuc
99b86a7
! 		    && (int)wp->w_virtcol >= vcol - eol_hl_off
99b86a7
  		    && (int)wp->w_virtcol < W_WIDTH(wp) * (row - startrow + 1)
99b86a7
  									   + v
99b86a7
  		    && lnum != wp->w_cursor.lnum
99b86a7
*** ../vim-7.1.151/src/version.c	Thu Nov  8 13:03:33 2007
99b86a7
--- src/version.c	Thu Nov  8 14:48:59 2007
99b86a7
***************
99b86a7
*** 668,669 ****
99b86a7
--- 668,671 ----
99b86a7
  {   /* Add new patch number below this line */
99b86a7
+ /**/
99b86a7
+     152,
99b86a7
  /**/
99b86a7
99b86a7
-- 
99b86a7
From "know your smileys":
99b86a7
 2B|^2B	  Message from Shakespeare
99b86a7
99b86a7
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
99b86a7
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
99b86a7
\\\        download, build and distribute -- http://www.A-A-P.org        ///
99b86a7
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///