From caabb3f058870aec3baad9553d402d5d43a618e4 Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Mon, 20 Dec 2010 21:57:36 +0100 Subject: [PATCH] Avoid unnecessary clearing of the status line When resizing a (Vim-) window don't use the CLEAR flag as it causes the status line to be redrawn (which causes problems for plugins like Command-T). The reason CLEAR was used in the first place was because resizing a window would cause display corruption due to wide letters like "w" spilling over into the neigboring display cell. To circumvent this problem we now always clear neigboring blank cells whenever a cell is cleared (just like other GUIs deal with faked bold glyphs spilling over into neighboring display cells). --- src/screen.c | 23 +++++++++++++++++++++++ src/window.c | 5 ----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/screen.c b/src/screen.c index 3fbad95651..c3eb2e8a5f 100644 --- a/src/screen.c +++ b/src/screen.c @@ -5432,7 +5432,9 @@ screen_line(row, coloff, endcol, clear_width hl = ScreenAttrs[off_to + CHAR_CELLS]; if (hl > HL_ALL) hl = syn_attr2attr(hl); +# ifndef FEAT_GUI_MACVIM /* see comment on subpixel antialiasing */ if (hl & HL_BOLD) +# endif redraw_this = TRUE; } #endif @@ -5563,7 +5565,9 @@ screen_line(row, coloff, endcol, clear_width hl = ScreenAttrs[off_to]; if (hl > HL_ALL) hl = syn_attr2attr(hl); +# ifndef FEAT_GUI_MACVIM /* see comment on subpixel antialiasing */ if (hl & HL_BOLD) +# endif redraw_next = TRUE; } #endif @@ -5649,7 +5653,9 @@ screen_line(row, coloff, endcol, clear_width if (gui.in_use && (col > startCol || !redraw_this)) { hl = ScreenAttrs[off_to]; +# ifndef FEAT_GUI_MACVIM /* see comment on subpixel antialiasing */ if (hl > HL_ALL || (hl & HL_BOLD)) +# endif { int prev_cells = 1; # ifdef FEAT_MBYTE @@ -6876,7 +6882,9 @@ screen_puts_len(text, len, row, col, attr) if (n > HL_ALL) n = syn_attr2attr(n); +# ifndef FEAT_GUI_MACVIM /* see comment on subpixel antialiasing */ if (n & HL_BOLD) +# endif force_redraw_next = TRUE; } #endif @@ -7751,6 +7759,12 @@ screen_fill(start_row, end_row, start_col, end_col, c1, c2, attr) || ScreenAttrs[off] != attr #if defined(FEAT_GUI) || defined(UNIX) || force_next +#endif +#ifdef FEAT_GUI_MACVIM + /* force a clear if the next char will be cleared (see + * comment on subpixel antialiasing) */ + || (gui.in_use && col+1 < end_col + && ScreenLines[off+1] != c) #endif ) { @@ -7771,12 +7785,21 @@ screen_fill(start_row, end_row, start_col, end_col, c1, c2, attr) # endif ) { +# ifndef FEAT_GUI_MACVIM if (ScreenLines[off] != ' ' && (ScreenAttrs[off] > HL_ALL || ScreenAttrs[off] & HL_BOLD)) force_next = TRUE; else force_next = FALSE; +# else + /* Mac OS X does subpixel antialiasing which often causes a + * glyph to spill over into neighboring cells. For this + * reason we always clear the neighboring glyphs whenever a + * glyph is cleared, just like other GUIs cope with the + * bold trick. */ + force_next = (ScreenLines[off] != ' '); +# endif } #endif ScreenLines[off] = c; diff --git a/src/window.c b/src/window.c index e2a4f1c863..02da52f651 100644 --- a/src/window.c +++ b/src/window.c @@ -5612,12 +5612,7 @@ win_new_height(wp, height) wp->w_prev_fraction_row = wp->w_wrow; win_comp_scroll(wp); -#ifdef FEAT_GUI_MACVIM - /* The view may have moved, so clear all or display may get corrupted. */ - redraw_win_later(wp, CLEAR); -#else redraw_win_later(wp, SOME_VALID); -#endif #ifdef FEAT_WINDOWS wp->w_redr_status = TRUE; #endif