test: :terminal + numberwidth=9

This commit is contained in:
Justin M. Keyes
2017-10-28 17:54:29 +02:00
parent b8a67551d8
commit bcf266de46
2 changed files with 41 additions and 29 deletions

View File

@@ -698,12 +698,12 @@ static void win_update(win_T *wp)
(uint16_t)(MAX(0, curwin->w_width - win_col_off(curwin))), (uint16_t)(MAX(0, curwin->w_width - win_col_off(curwin))),
(uint16_t)curwin->w_height); (uint16_t)curwin->w_height);
} }
} else if (buf->b_mod_set && buf->b_mod_xlines != 0 && wp->w_redraw_top != 0) { } else if (buf->b_mod_set
/* && buf->b_mod_xlines != 0
* When there are both inserted/deleted lines and specific lines to be && wp->w_redraw_top != 0) {
* redrawn, w_redraw_top and w_redraw_bot may be invalid, just redraw // When there are both inserted/deleted lines and specific lines to be
* everything (only happens when redrawing is off for while). // 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; type = NOT_VALID;
} else { } else {
/* /*

View File

@@ -11,37 +11,49 @@ describe('terminal window', function()
screen = thelpers.screen_setup() screen = thelpers.screen_setup()
end) end)
describe('with number set', function() describe("with 'number'", function()
before_each(function() it('wraps text', function()
feed('<c-\\><c-n>:set number<cr>i') feed([[<C-\><C-N>]])
feed([[:set numberwidth=1 number<CR>i]])
screen:expect([[ screen:expect([[
{7: 1 }tty ready | {7:1 }tty ready |
{7: 2 }rows: 6, cols: 46 | {7:2 }rows: 6, cols: 48 |
{7: 3 }{1: } | {7:3 }{1: } |
{7: 4 } | {7:4 } |
{7: 5 } | {7:5 } |
{7: 6 } | {7:6 } |
{3:-- TERMINAL --} | {3:-- TERMINAL --} |
]]) ]])
end)
it('wraps text correctly', function()
thelpers.feed_data({'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'}) thelpers.feed_data({'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'})
screen:expect([[ screen:expect([[
{7: 1 }tty ready | {7:1 }tty ready |
{7: 2 }rows: 6, cols: 46 | {7:2 }rows: 6, cols: 48 |
{7: 3 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRST| {7:3 }abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV|
{7: 4 }UVWXYZ{1: } | {7:4 }WXYZ{1: } |
{7: 5 } | {7:5 } |
{7: 6 } | {7:6 } |
{3:-- TERMINAL --} |
]])
-- numberwidth=9
feed([[<C-\><C-N>]])
feed([[:set numberwidth=9 number<CR>i]])
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 --} | {3:-- TERMINAL --} |
]]) ]])
end) end)
end) end)
describe('with colorcolumn set', function() describe("with 'colorcolumn'", function()
before_each(function() before_each(function()
feed('<c-\\><c-n>') feed([[<C-\><C-N>]])
screen:expect([[ screen:expect([[
tty ready | tty ready |
{2:^ } | {2:^ } |
@@ -51,7 +63,7 @@ describe('terminal window', function()
| |
| |
]]) ]])
feed(':set colorcolumn=20<cr>i') feed(':set colorcolumn=20<CR>i')
end) end)
it('wont show the color column', function() it('wont show the color column', function()
@@ -69,7 +81,7 @@ describe('terminal window', function()
describe('with fold set', function() describe('with fold set', function()
before_each(function() before_each(function()
feed('<c-\\><c-n>:set foldenable foldmethod=manual<cr>i') feed([[<C-\><C-N>:set foldenable foldmethod=manual<CR>i]])
thelpers.feed_data({'line1', 'line2', 'line3', 'line4', ''}) thelpers.feed_data({'line1', 'line2', 'line3', 'line4', ''})
screen:expect([[ screen:expect([[
tty ready | tty ready |
@@ -83,7 +95,7 @@ describe('terminal window', function()
end) end)
it('wont show any folds', function() it('wont show any folds', function()
feed('<c-\\><c-n>ggvGzf') feed([[<C-\><C-N>ggvGzf]])
wait() wait()
screen:expect([[ screen:expect([[
^tty ready | ^tty ready |