components/vim/vim72-patches/7.2.141
changeset 379 c6a17bba1da3
parent 378 f0b61ed1d10d
child 380 e92b3b4a1c66
equal deleted inserted replaced
378:f0b61ed1d10d 379:c6a17bba1da3
     1 To: [email protected]
       
     2 Subject: Patch 7.2.141
       
     3 Fcc: outbox
       
     4 From: Bram Moolenaar <[email protected]>
       
     5 Mime-Version: 1.0
       
     6 Content-Type: text/plain; charset=ISO-8859-1
       
     7 Content-Transfer-Encoding: 8bit
       
     8 ------------
       
     9 
       
    10 Patch 7.2.141
       
    11 Problem:    When redrawing a character for bold spill this causes the next
       
    12 	    character to be redrawn as well.
       
    13 Solution:   Only redraw one extra character. (Yukihiro Nakadaira)
       
    14 Files:	    src/screen.c
       
    15 
       
    16 
       
    17 *** ../vim-7.2.140/src/screen.c	Wed Mar 11 17:44:38 2009
       
    18 --- src/screen.c	Wed Mar 11 13:59:24 2009
       
    19 ***************
       
    20 *** 5132,5139 ****
       
    21   #endif
       
    22   
       
    23   #if defined(FEAT_GUI) || defined(UNIX)
       
    24 ! 	    /* The bold trick makes a single row of pixels appear in the next
       
    25 ! 	     * character.  When a bold character is removed, the next
       
    26   	     * character should be redrawn too.  This happens for our own GUI
       
    27   	     * and for some xterms. */
       
    28   	    if (
       
    29 --- 5132,5139 ----
       
    30   #endif
       
    31   
       
    32   #if defined(FEAT_GUI) || defined(UNIX)
       
    33 ! 	    /* The bold trick makes a single column of pixels appear in the
       
    34 ! 	     * next character.  When a bold character is removed, the next
       
    35   	     * character should be redrawn too.  This happens for our own GUI
       
    36   	     * and for some xterms. */
       
    37   	    if (
       
    38 ***************
       
    39 *** 6276,6284 ****
       
    40 --- 6276,6290 ----
       
    41       int		pcc[MAX_MCO];
       
    42   # endif
       
    43   #endif
       
    44 + #if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
       
    45 +     int		force_redraw_this;
       
    46 +     int		force_redraw_next = FALSE;
       
    47 + #endif
       
    48 +     int		need_redraw;
       
    49   
       
    50       if (ScreenLines == NULL || row >= screen_Rows)	/* safety check */
       
    51   	return;
       
    52 +     off = LineOffset[row] + col;
       
    53   
       
    54   #ifdef FEAT_MBYTE
       
    55       /* When drawing over the right halve of a double-wide char clear out the
       
    56 ***************
       
    57 *** 6288,6297 ****
       
    58   	    && !gui.in_use
       
    59   # endif
       
    60   	    && mb_fix_col(col, row) != col)
       
    61 ! 	screen_puts_len((char_u *)" ", 1, row, col - 1, 0);
       
    62   #endif
       
    63   
       
    64 -     off = LineOffset[row] + col;
       
    65   #ifdef FEAT_MBYTE
       
    66       max_off = LineOffset[row] + screen_Columns;
       
    67   #endif
       
    68 --- 6294,6314 ----
       
    69   	    && !gui.in_use
       
    70   # endif
       
    71   	    && mb_fix_col(col, row) != col)
       
    72 !     {
       
    73 ! 	ScreenLines[off - 1] = ' ';
       
    74 ! 	ScreenAttrs[off - 1] = 0;
       
    75 ! 	if (enc_utf8)
       
    76 ! 	{
       
    77 ! 	    ScreenLinesUC[off - 1] = 0;
       
    78 ! 	    ScreenLinesC[0][off - 1] = 0;
       
    79 ! 	}
       
    80 ! 	/* redraw the previous cell, make it empty */
       
    81 ! 	screen_char(off - 1, row, col - 1);
       
    82 ! 	/* force the cell at "col" to be redrawn */
       
    83 ! 	force_redraw_next = TRUE;
       
    84 !     }
       
    85   #endif
       
    86   
       
    87   #ifdef FEAT_MBYTE
       
    88       max_off = LineOffset[row] + screen_Columns;
       
    89   #endif
       
    90 ***************
       
    91 *** 6355,6361 ****
       
    92   	}
       
    93   #endif
       
    94   
       
    95 ! 	if (ScreenLines[off] != c
       
    96   #ifdef FEAT_MBYTE
       
    97   		|| (mbyte_cells == 2
       
    98   		    && ScreenLines[off + 1] != (enc_dbcs ? ptr[1] : 0))
       
    99 --- 6372,6383 ----
       
   100   	}
       
   101   #endif
       
   102   
       
   103 ! #if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
       
   104 ! 	force_redraw_this = force_redraw_next;
       
   105 ! 	force_redraw_next = FALSE;
       
   106 ! #endif
       
   107 ! 
       
   108 ! 	need_redraw = ScreenLines[off] != c
       
   109   #ifdef FEAT_MBYTE
       
   110   		|| (mbyte_cells == 2
       
   111   		    && ScreenLines[off + 1] != (enc_dbcs ? ptr[1] : 0))
       
   112 ***************
       
   113 *** 6367,6386 ****
       
   114   			|| screen_comp_differs(off, u8cc)))
       
   115   #endif
       
   116   		|| ScreenAttrs[off] != attr
       
   117 ! 		|| exmode_active
       
   118   		)
       
   119   	{
       
   120   #if defined(FEAT_GUI) || defined(UNIX)
       
   121   	    /* The bold trick makes a single row of pixels appear in the next
       
   122   	     * character.  When a bold character is removed, the next
       
   123   	     * character should be redrawn too.  This happens for our own GUI
       
   124 ! 	     * and for some xterms.
       
   125 ! 	     * Force the redraw by setting the attribute to a different value
       
   126 ! 	     * than "attr", the contents of ScreenLines[] may be needed by
       
   127 ! 	     * mb_off2cells() further on.
       
   128 ! 	     * Don't do this for the last drawn character, because the next
       
   129 ! 	     * character may not be redrawn. */
       
   130 ! 	    if (
       
   131   # ifdef FEAT_GUI
       
   132   		    gui.in_use
       
   133   # endif
       
   134 --- 6389,6408 ----
       
   135   			|| screen_comp_differs(off, u8cc)))
       
   136   #endif
       
   137   		|| ScreenAttrs[off] != attr
       
   138 ! 		|| exmode_active;
       
   139 ! 
       
   140 ! 	if (need_redraw
       
   141 ! #if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
       
   142 ! 		|| force_redraw_this
       
   143 ! #endif
       
   144   		)
       
   145   	{
       
   146   #if defined(FEAT_GUI) || defined(UNIX)
       
   147   	    /* The bold trick makes a single row of pixels appear in the next
       
   148   	     * character.  When a bold character is removed, the next
       
   149   	     * character should be redrawn too.  This happens for our own GUI
       
   150 ! 	     * and for some xterms. */
       
   151 ! 	    if (need_redraw && ScreenLines[off] != ' ' && (
       
   152   # ifdef FEAT_GUI
       
   153   		    gui.in_use
       
   154   # endif
       
   155 ***************
       
   156 *** 6390,6412 ****
       
   157   # ifdef UNIX
       
   158   		    term_is_xterm
       
   159   # endif
       
   160 ! 	       )
       
   161   	    {
       
   162 ! 		int		n;
       
   163   
       
   164 ! 		n = ScreenAttrs[off];
       
   165 ! # ifdef FEAT_MBYTE
       
   166 ! 		if (col + mbyte_cells < screen_Columns
       
   167 ! 			&& (n > HL_ALL || (n & HL_BOLD))
       
   168 ! 			&& (len < 0 ? ptr[mbyte_blen] != NUL
       
   169 ! 					     : ptr + mbyte_blen < text + len))
       
   170 ! 		    ScreenAttrs[off + mbyte_cells] = attr + 1;
       
   171 ! # else
       
   172 ! 		if (col + 1 < screen_Columns
       
   173 ! 			&& (n > HL_ALL || (n & HL_BOLD))
       
   174 ! 			&& (len < 0 ? ptr[1] != NUL : ptr + 1 < text + len))
       
   175 ! 		    ScreenLines[off + 1] = 0;
       
   176 ! # endif
       
   177   	    }
       
   178   #endif
       
   179   #ifdef FEAT_MBYTE
       
   180 --- 6412,6425 ----
       
   181   # ifdef UNIX
       
   182   		    term_is_xterm
       
   183   # endif
       
   184 ! 		    ))
       
   185   	    {
       
   186 ! 		int	n = ScreenAttrs[off];
       
   187   
       
   188 ! 		if (n > HL_ALL)
       
   189 ! 		    n = syn_attr2attr(n);
       
   190 ! 		if (n & HL_BOLD)
       
   191 ! 		    force_redraw_next = TRUE;
       
   192   	    }
       
   193   #endif
       
   194   #ifdef FEAT_MBYTE
       
   195 ***************
       
   196 *** 6493,6498 ****
       
   197 --- 6506,6525 ----
       
   198   	    ++ptr;
       
   199   	}
       
   200       }
       
   201 + 
       
   202 + #if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
       
   203 +     /* If we detected the next character needs to be redrawn, but the text
       
   204 +      * doesn't extend up to there, update the character here. */
       
   205 +     if (force_redraw_next && col < screen_Columns)
       
   206 +     {
       
   207 + # ifdef FEAT_MBYTE
       
   208 + 	if (enc_dbcs != 0 && dbcs_off2cells(off, max_off) > 1)
       
   209 + 	    screen_char_2(off, row, col);
       
   210 + 	else
       
   211 + # endif
       
   212 + 	    screen_char(off, row, col);
       
   213 +     }
       
   214 + #endif
       
   215   }
       
   216   
       
   217   #ifdef FEAT_SEARCH_EXTRA
       
   218 *** ../vim-7.2.140/src/version.c	Wed Mar 11 17:44:38 2009
       
   219 --- src/version.c	Wed Mar 11 17:55:22 2009
       
   220 ***************
       
   221 *** 678,679 ****
       
   222 --- 678,681 ----
       
   223   {   /* Add new patch number below this line */
       
   224 + /**/
       
   225 +     141,
       
   226   /**/
       
   227 
       
   228 -- 
       
   229 Some of the well know MS-Windows errors:
       
   230 	ETIME		Wrong time, wait a little while
       
   231 	ECRASH		Try again...
       
   232 	EDETECT		Unable to detect errors
       
   233 	EOVER		You lost!  Play another game?
       
   234 	ENOCLUE		Eh, what did you want?
       
   235 
       
   236  /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
       
   237 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
       
   238 \\\        download, build and distribute -- http://www.A-A-P.org        ///
       
   239  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///