diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 28b85dcc5f..38ecd88ec0 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -698,12 +698,12 @@ static void win_update(win_T *wp) (uint16_t)(MAX(0, curwin->w_width - win_col_off(curwin))), (uint16_t)curwin->w_height); } - } else if (buf->b_mod_set && buf->b_mod_xlines != 0 && wp->w_redraw_top != 0) { - /* - * When there are both inserted/deleted lines and specific lines to be - * redrawn, w_redraw_top and w_redraw_bot may be invalid, just redraw - * everything (only happens when redrawing is off for while). - */ + } else if (buf->b_mod_set + && buf->b_mod_xlines != 0 + && wp->w_redraw_top != 0) { + // When there are both inserted/deleted lines and specific lines to be + // redrawn, w_redraw_top and w_redraw_bot may be invalid, just redraw + // everything (only happens when redrawing is off for while). type = NOT_VALID; } else { /* diff --git a/test/functional/terminal/window_spec.lua b/test/functional/terminal/window_spec.lua index df8324fd6d..10a9fabb42 100644 --- a/test/functional/terminal/window_spec.lua +++ b/test/functional/terminal/window_spec.lua @@ -11,37 +11,49 @@ describe('terminal window', function() screen = thelpers.screen_setup() end) - describe('with number set', function() - before_each(function() - feed(':set numberi') + describe("with 'number'", function() + it('wraps text', function() + feed([[]]) + feed([[:set numberwidth=1 numberi]]) screen:expect([[ - {7: 1 }tty ready | - {7: 2 }rows: 6, cols: 46 | - {7: 3 }{1: } | - {7: 4 } | - {7: 5 } | - {7: 6 } | + {7:1 }tty ready | + {7:2 }rows: 6, cols: 48 | + {7:3 }{1: } | + {7:4 } | + {7:5 } | + {7:6 } | {3:-- TERMINAL --} | ]]) - end) - - it('wraps text correctly', function() thelpers.feed_data({'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'}) screen:expect([[ - {7: 1 }tty ready | - {7: 2 }rows: 6, cols: 46 | - {7: 3 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRST| - {7: 4 }UVWXYZ{1: } | - {7: 5 } | - {7: 6 } | + {7:1 }tty ready | + {7:2 }rows: 6, cols: 48 | + {7:3 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV| + {7:4 }WXYZ{1: } | + {7:5 } | + {7:6 } | + {3:-- TERMINAL --} | + ]]) + + -- numberwidth=9 + feed([[]]) + feed([[:set numberwidth=9 numberi]]) + thelpers.feed_data({' abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'}) + screen:expect([[ + {7: 1 }tty ready | + {7: 2 }rows: 6, cols: 48 | + {7: 3 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNO| + {7: 4 }WXYZ abcdefghijklmnopqrstuvwxyzABCDEFGHIJ| + {7: 5 }KLMNOPQRSTUVWXYZrows: 6, cols: 41 | + {7: 6 }{1: } | {3:-- TERMINAL --} | ]]) end) end) - describe('with colorcolumn set', function() + describe("with 'colorcolumn'", function() before_each(function() - feed('') + feed([[]]) screen:expect([[ tty ready | {2:^ } | @@ -51,7 +63,7 @@ describe('terminal window', function() | | ]]) - feed(':set colorcolumn=20i') + feed(':set colorcolumn=20i') end) it('wont show the color column', function() @@ -69,7 +81,7 @@ describe('terminal window', function() describe('with fold set', function() before_each(function() - feed(':set foldenable foldmethod=manuali') + feed([[:set foldenable foldmethod=manuali]]) thelpers.feed_data({'line1', 'line2', 'line3', 'line4', ''}) screen:expect([[ tty ready | @@ -83,7 +95,7 @@ describe('terminal window', function() end) it('wont show any folds', function() - feed('ggvGzf') + feed([[ggvGzf]]) wait() screen:expect([[ ^tty ready |