Bram Moolenaar wrote: > Patch 7.2.119 > Problem: Status line is redrawn too often. > Solution: Check ScreeenLinesUC[] properly. (Yukihiro Nakadaira) > Files: src/screen.c
Sorry, one more patch related to this. When bold character is overwritten, all of rest characters are redrawn. See following code in the screen_puts_len() function. At line 6402 "attr + 1" is assigned to next cell. And "n > HL_ALL" is always true when syntax highlighting is used. So once character is drawn, all of rest characters are redrawn. Please check attached patch. 6372 #if defined(FEAT_GUI) || defined(UNIX) 6373 /* The bold trick makes a single row of pixels appear in the next 6374 * character. When a bold character is removed, the next 6375 * character should be redrawn too. This happens for our own GUI 6376 * and for some xterms. 6377 * Force the redraw by setting the attribute to a different value 6378 * than "attr", the contents of ScreenLines[] may be needed by 6379 * mb_off2cells() further on. 6380 * Don't do this for the last drawn character, because the next 6381 * character may not be redrawn. */ 6382 if ( 6383 # ifdef FEAT_GUI 6384 gui.in_use 6385 # endif 6386 # if defined(FEAT_GUI) && defined(UNIX) 6387 || 6388 # endif 6389 # ifdef UNIX 6390 term_is_xterm 6391 # endif 6392 ) 6393 { 6394 int n; 6395 6396 n = ScreenAttrs[off]; 6397 # ifdef FEAT_MBYTE 6398 if (col + mbyte_cells < screen_Columns 6399 && (n > HL_ALL || (n & HL_BOLD)) 6400 && (len < 0 ? ptr[mbyte_blen] != NUL 6401 : ptr + mbyte_blen < text + len)) 6402 ScreenAttrs[off + mbyte_cells] = attr + 1; 6403 # else 6404 if (col + 1 < screen_Columns 6405 && (n > HL_ALL || (n & HL_BOLD)) 6406 && (len < 0 ? ptr[1] != NUL : ptr + 1 < text + len)) 6407 ScreenLines[off + 1] = 0; 6408 # endif 6409 } 6410 #endif -- Yukihiro Nakadaira - yukihiro.nakada...@gmail.com --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
Index: src/screen.c =================================================================== RCS file: /cvsroot/vim/vim7/src/screen.c,v retrieving revision 1.113 diff -u -r1.113 screen.c --- src/screen.c 22 Feb 2009 00:14:54 -0000 1.113 +++ src/screen.c 22 Feb 2009 17:20:54 -0000 @@ -6275,6 +6275,10 @@ int pcc[MAX_MCO]; # endif #endif +#if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX) + int redraw_this; + int redraw_next = FALSE; +#endif if (ScreenLines == NULL || row >= screen_Rows) /* safety check */ return; @@ -6287,7 +6291,25 @@ && !gui.in_use # endif && mb_fix_col(col, row) != col) - screen_puts_len((char_u *)" ", 1, row, col - 1, 0); + { + int i; + + off = LineOffset[row] + col; + for (i = 0; i < 2; ++i) + { + ScreenLines[off - i] = ' '; + ScreenAttrs[off - i] = 0; + if (enc_utf8) + { + ScreenLinesUC[off - i] = 0; + ScreenLinesC[0][off - i] = 0; + } + } + /* redraw only previous cell */ + screen_char(off - 1, row, col - 1); + /* force the first cell be redrawn */ + redraw_next = TRUE; + } #endif off = LineOffset[row] + col; @@ -6354,6 +6376,11 @@ } #endif +#if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX) + redraw_this = redraw_next; + redraw_next = FALSE; +#endif + if (ScreenLines[off] != c #ifdef FEAT_MBYTE || (mbyte_cells == 2 @@ -6367,18 +6394,16 @@ #endif || ScreenAttrs[off] != attr || exmode_active +#if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX) + || redraw_this +#endif ) { #if defined(FEAT_GUI) || defined(UNIX) /* The bold trick makes a single row of pixels appear in the next * character. When a bold character is removed, the next * character should be redrawn too. This happens for our own GUI - * and for some xterms. - * Force the redraw by setting the attribute to a different value - * than "attr", the contents of ScreenLines[] may be needed by - * mb_off2cells() further on. - * Don't do this for the last drawn character, because the next - * character may not be redrawn. */ + * and for some xterms. */ if ( # ifdef FEAT_GUI gui.in_use @@ -6394,18 +6419,10 @@ int n; n = ScreenAttrs[off]; -# ifdef FEAT_MBYTE - if (col + mbyte_cells < screen_Columns - && (n > HL_ALL || (n & HL_BOLD)) - && (len < 0 ? ptr[mbyte_blen] != NUL - : ptr + mbyte_blen < text + len)) - ScreenAttrs[off + mbyte_cells] = attr + 1; -# else - if (col + 1 < screen_Columns - && (n > HL_ALL || (n & HL_BOLD)) - && (len < 0 ? ptr[1] != NUL : ptr + 1 < text + len)) - ScreenLines[off + 1] = 0; -# endif + if (n > HL_ALL) + n = syn_attr2attr(n); + if (n & HL_BOLD) + redraw_next = TRUE; } #endif #ifdef FEAT_MBYTE @@ -6492,6 +6509,17 @@ ++ptr; } } +#if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX) + if (redraw_next && col < screen_Columns) + { +# if defined(FEAT_MBYTE) + if (enc_dbcs != 0 && dbcs_off2cells(off, max_off) > 1) + screen_char_2(off, row, col); + else +# endif + screen_char(off, row, col); + } +#endif } #ifdef FEAT_SEARCH_EXTRA