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