6e1f225
To: vim-dev@vim.org
6e1f225
Subject: Patch 7.2.141
6e1f225
Fcc: outbox
6e1f225
From: Bram Moolenaar <Bram@moolenaar.net>
6e1f225
Mime-Version: 1.0
6e1f225
Content-Type: text/plain; charset=ISO-8859-1
6e1f225
Content-Transfer-Encoding: 8bit
6e1f225
------------
6e1f225
6e1f225
Patch 7.2.141
6e1f225
Problem:    When redrawing a character for bold spill this causes the next
6e1f225
	    character to be redrawn as well.
6e1f225
Solution:   Only redraw one extra character. (Yukihiro Nakadaira)
6e1f225
Files:	    src/screen.c
6e1f225
6e1f225
6e1f225
*** ../vim-7.2.140/src/screen.c	Wed Mar 11 17:44:38 2009
6e1f225
--- src/screen.c	Wed Mar 11 13:59:24 2009
6e1f225
***************
6e1f225
*** 5132,5139 ****
6e1f225
  #endif
6e1f225
  
6e1f225
  #if defined(FEAT_GUI) || defined(UNIX)
6e1f225
! 	    /* The bold trick makes a single row of pixels appear in the next
6e1f225
! 	     * character.  When a bold character is removed, the next
6e1f225
  	     * character should be redrawn too.  This happens for our own GUI
6e1f225
  	     * and for some xterms. */
6e1f225
  	    if (
6e1f225
--- 5132,5139 ----
6e1f225
  #endif
6e1f225
  
6e1f225
  #if defined(FEAT_GUI) || defined(UNIX)
6e1f225
! 	    /* The bold trick makes a single column of pixels appear in the
6e1f225
! 	     * next character.  When a bold character is removed, the next
6e1f225
  	     * character should be redrawn too.  This happens for our own GUI
6e1f225
  	     * and for some xterms. */
6e1f225
  	    if (
6e1f225
***************
6e1f225
*** 6276,6284 ****
6e1f225
--- 6276,6290 ----
6e1f225
      int		pcc[MAX_MCO];
6e1f225
  # endif
6e1f225
  #endif
6e1f225
+ #if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
6e1f225
+     int		force_redraw_this;
6e1f225
+     int		force_redraw_next = FALSE;
6e1f225
+ #endif
6e1f225
+     int		need_redraw;
6e1f225
  
6e1f225
      if (ScreenLines == NULL || row >= screen_Rows)	/* safety check */
6e1f225
  	return;
6e1f225
+     off = LineOffset[row] + col;
6e1f225
  
6e1f225
  #ifdef FEAT_MBYTE
6e1f225
      /* When drawing over the right halve of a double-wide char clear out the
6e1f225
***************
6e1f225
*** 6288,6297 ****
6e1f225
  	    && !gui.in_use
6e1f225
  # endif
6e1f225
  	    && mb_fix_col(col, row) != col)
6e1f225
! 	screen_puts_len((char_u *)" ", 1, row, col - 1, 0);
6e1f225
  #endif
6e1f225
  
6e1f225
-     off = LineOffset[row] + col;
6e1f225
  #ifdef FEAT_MBYTE
6e1f225
      max_off = LineOffset[row] + screen_Columns;
6e1f225
  #endif
6e1f225
--- 6294,6314 ----
6e1f225
  	    && !gui.in_use
6e1f225
  # endif
6e1f225
  	    && mb_fix_col(col, row) != col)
6e1f225
!     {
6e1f225
! 	ScreenLines[off - 1] = ' ';
6e1f225
! 	ScreenAttrs[off - 1] = 0;
6e1f225
! 	if (enc_utf8)
6e1f225
! 	{
6e1f225
! 	    ScreenLinesUC[off - 1] = 0;
6e1f225
! 	    ScreenLinesC[0][off - 1] = 0;
6e1f225
! 	}
6e1f225
! 	/* redraw the previous cell, make it empty */
6e1f225
! 	screen_char(off - 1, row, col - 1);
6e1f225
! 	/* force the cell at "col" to be redrawn */
6e1f225
! 	force_redraw_next = TRUE;
6e1f225
!     }
6e1f225
  #endif
6e1f225
  
6e1f225
  #ifdef FEAT_MBYTE
6e1f225
      max_off = LineOffset[row] + screen_Columns;
6e1f225
  #endif
6e1f225
***************
6e1f225
*** 6355,6361 ****
6e1f225
  	}
6e1f225
  #endif
6e1f225
  
6e1f225
! 	if (ScreenLines[off] != c
6e1f225
  #ifdef FEAT_MBYTE
6e1f225
  		|| (mbyte_cells == 2
6e1f225
  		    && ScreenLines[off + 1] != (enc_dbcs ? ptr[1] : 0))
6e1f225
--- 6372,6383 ----
6e1f225
  	}
6e1f225
  #endif
6e1f225
  
6e1f225
! #if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
6e1f225
! 	force_redraw_this = force_redraw_next;
6e1f225
! 	force_redraw_next = FALSE;
6e1f225
! #endif
6e1f225
! 
6e1f225
! 	need_redraw = ScreenLines[off] != c
6e1f225
  #ifdef FEAT_MBYTE
6e1f225
  		|| (mbyte_cells == 2
6e1f225
  		    && ScreenLines[off + 1] != (enc_dbcs ? ptr[1] : 0))
6e1f225
***************
6e1f225
*** 6367,6386 ****
6e1f225
  			|| screen_comp_differs(off, u8cc)))
6e1f225
  #endif
6e1f225
  		|| ScreenAttrs[off] != attr
6e1f225
! 		|| exmode_active
6e1f225
  		)
6e1f225
  	{
6e1f225
  #if defined(FEAT_GUI) || defined(UNIX)
6e1f225
  	    /* The bold trick makes a single row of pixels appear in the next
6e1f225
  	     * character.  When a bold character is removed, the next
6e1f225
  	     * character should be redrawn too.  This happens for our own GUI
6e1f225
! 	     * and for some xterms.
6e1f225
! 	     * Force the redraw by setting the attribute to a different value
6e1f225
! 	     * than "attr", the contents of ScreenLines[] may be needed by
6e1f225
! 	     * mb_off2cells() further on.
6e1f225
! 	     * Don't do this for the last drawn character, because the next
6e1f225
! 	     * character may not be redrawn. */
6e1f225
! 	    if (
6e1f225
  # ifdef FEAT_GUI
6e1f225
  		    gui.in_use
6e1f225
  # endif
6e1f225
--- 6389,6408 ----
6e1f225
  			|| screen_comp_differs(off, u8cc)))
6e1f225
  #endif
6e1f225
  		|| ScreenAttrs[off] != attr
6e1f225
! 		|| exmode_active;
6e1f225
! 
6e1f225
! 	if (need_redraw
6e1f225
! #if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
6e1f225
! 		|| force_redraw_this
6e1f225
! #endif
6e1f225
  		)
6e1f225
  	{
6e1f225
  #if defined(FEAT_GUI) || defined(UNIX)
6e1f225
  	    /* The bold trick makes a single row of pixels appear in the next
6e1f225
  	     * character.  When a bold character is removed, the next
6e1f225
  	     * character should be redrawn too.  This happens for our own GUI
6e1f225
! 	     * and for some xterms. */
6e1f225
! 	    if (need_redraw && ScreenLines[off] != ' ' && (
6e1f225
  # ifdef FEAT_GUI
6e1f225
  		    gui.in_use
6e1f225
  # endif
6e1f225
***************
6e1f225
*** 6390,6412 ****
6e1f225
  # ifdef UNIX
6e1f225
  		    term_is_xterm
6e1f225
  # endif
6e1f225
! 	       )
6e1f225
  	    {
6e1f225
! 		int		n;
6e1f225
  
6e1f225
! 		n = ScreenAttrs[off];
6e1f225
! # ifdef FEAT_MBYTE
6e1f225
! 		if (col + mbyte_cells < screen_Columns
6e1f225
! 			&& (n > HL_ALL || (n & HL_BOLD))
6e1f225
! 			&& (len < 0 ? ptr[mbyte_blen] != NUL
6e1f225
! 					     : ptr + mbyte_blen < text + len))
6e1f225
! 		    ScreenAttrs[off + mbyte_cells] = attr + 1;
6e1f225
! # else
6e1f225
! 		if (col + 1 < screen_Columns
6e1f225
! 			&& (n > HL_ALL || (n & HL_BOLD))
6e1f225
! 			&& (len < 0 ? ptr[1] != NUL : ptr + 1 < text + len))
6e1f225
! 		    ScreenLines[off + 1] = 0;
6e1f225
! # endif
6e1f225
  	    }
6e1f225
  #endif
6e1f225
  #ifdef FEAT_MBYTE
6e1f225
--- 6412,6425 ----
6e1f225
  # ifdef UNIX
6e1f225
  		    term_is_xterm
6e1f225
  # endif
6e1f225
! 		    ))
6e1f225
  	    {
6e1f225
! 		int	n = ScreenAttrs[off];
6e1f225
  
6e1f225
! 		if (n > HL_ALL)
6e1f225
! 		    n = syn_attr2attr(n);
6e1f225
! 		if (n & HL_BOLD)
6e1f225
! 		    force_redraw_next = TRUE;
6e1f225
  	    }
6e1f225
  #endif
6e1f225
  #ifdef FEAT_MBYTE
6e1f225
***************
6e1f225
*** 6493,6498 ****
6e1f225
--- 6506,6525 ----
6e1f225
  	    ++ptr;
6e1f225
  	}
6e1f225
      }
6e1f225
+ 
6e1f225
+ #if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
6e1f225
+     /* If we detected the next character needs to be redrawn, but the text
6e1f225
+      * doesn't extend up to there, update the character here. */
6e1f225
+     if (force_redraw_next && col < screen_Columns)
6e1f225
+     {
6e1f225
+ # ifdef FEAT_MBYTE
6e1f225
+ 	if (enc_dbcs != 0 && dbcs_off2cells(off, max_off) > 1)
6e1f225
+ 	    screen_char_2(off, row, col);
6e1f225
+ 	else
6e1f225
+ # endif
6e1f225
+ 	    screen_char(off, row, col);
6e1f225
+     }
6e1f225
+ #endif
6e1f225
  }
6e1f225
  
6e1f225
  #ifdef FEAT_SEARCH_EXTRA
6e1f225
*** ../vim-7.2.140/src/version.c	Wed Mar 11 17:44:38 2009
6e1f225
--- src/version.c	Wed Mar 11 17:55:22 2009
6e1f225
***************
6e1f225
*** 678,679 ****
6e1f225
--- 678,681 ----
6e1f225
  {   /* Add new patch number below this line */
6e1f225
+ /**/
6e1f225
+     141,
6e1f225
  /**/
6e1f225
6e1f225
-- 
6e1f225
Some of the well know MS-Windows errors:
6e1f225
	ETIME		Wrong time, wait a little while
6e1f225
	ECRASH		Try again...
6e1f225
	EDETECT		Unable to detect errors
6e1f225
	EOVER		You lost!  Play another game?
6e1f225
	ENOCLUE		Eh, what did you want?
6e1f225
6e1f225
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
6e1f225
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
6e1f225
\\\        download, build and distribute -- http://www.A-A-P.org        ///
6e1f225
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///