mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.1.1171: statusline test could fail in large terminal
Problem: Statusline test could fail in large terminal.
Solution: Make the test work on a huge terminal. (Dominique Pelle,
closes vim/vim#4255)
316c16797a
This commit is contained in:
parent
4ed654d9e8
commit
f1464d0d80
@ -62,23 +62,23 @@ func Test_statusline()
|
|||||||
only
|
only
|
||||||
set laststatus=2
|
set laststatus=2
|
||||||
set splitbelow
|
set splitbelow
|
||||||
call setline(1, range(1, 200))
|
call setline(1, range(1, 10000))
|
||||||
|
|
||||||
" %b: Value of character under cursor.
|
" %b: Value of character under cursor.
|
||||||
" %B: As above, in hexadecimal.
|
" %B: As above, in hexadecimal.
|
||||||
call cursor(180, 2)
|
call cursor(9000, 1)
|
||||||
set statusline=%b,%B
|
set statusline=%b,%B
|
||||||
call assert_match('^56,38\s*$', s:get_statusline())
|
call assert_match('^57,39\s*$', s:get_statusline())
|
||||||
|
|
||||||
" %o: Byte number in file of byte under cursor, first byte is 1.
|
" %o: Byte number in file of byte under cursor, first byte is 1.
|
||||||
" %O: As above, in hexadecimal.
|
" %O: As above, in hexadecimal.
|
||||||
set statusline=%o,%O
|
set statusline=%o,%O
|
||||||
set fileformat=dos
|
set fileformat=dos
|
||||||
call assert_match('^789,315\s*$', s:get_statusline())
|
call assert_match('^52888,CE98\s*$', s:get_statusline())
|
||||||
set fileformat=mac
|
set fileformat=mac
|
||||||
call assert_match('^610,262\s*$', s:get_statusline())
|
call assert_match('^43889,AB71\s*$', s:get_statusline())
|
||||||
set fileformat=unix
|
set fileformat=unix
|
||||||
call assert_match('^610,262\s*$', s:get_statusline())
|
call assert_match('^43889,AB71\s*$', s:get_statusline())
|
||||||
set fileformat&
|
set fileformat&
|
||||||
|
|
||||||
" %f: Path to the file in the buffer, as typed or relative to current dir.
|
" %f: Path to the file in the buffer, as typed or relative to current dir.
|
||||||
@ -112,7 +112,7 @@ func Test_statusline()
|
|||||||
" %L: Number of line in buffer.
|
" %L: Number of line in buffer.
|
||||||
" %c: Column number.
|
" %c: Column number.
|
||||||
set statusline=%l/%L,%c
|
set statusline=%l/%L,%c
|
||||||
call assert_match('^180/200,2\s*$', s:get_statusline())
|
call assert_match('^9000/10000,1\s*$', s:get_statusline())
|
||||||
|
|
||||||
" %m: Modified flag, text is "[+]", "[-]" if 'modifiable' is off.
|
" %m: Modified flag, text is "[+]", "[-]" if 'modifiable' is off.
|
||||||
" %M: Modified flag, text is ",+" or ",-".
|
" %M: Modified flag, text is ",+" or ",-".
|
||||||
@ -136,7 +136,7 @@ func Test_statusline()
|
|||||||
call assert_match('^0,Top\s*$', s:get_statusline())
|
call assert_match('^0,Top\s*$', s:get_statusline())
|
||||||
norm G
|
norm G
|
||||||
call assert_match('^100,Bot\s*$', s:get_statusline())
|
call assert_match('^100,Bot\s*$', s:get_statusline())
|
||||||
180
|
9000
|
||||||
" Don't check the exact percentage as it depends on the window size
|
" Don't check the exact percentage as it depends on the window size
|
||||||
call assert_match('^90,\(Top\|Bot\|\d\+%\)\s*$', s:get_statusline())
|
call assert_match('^90,\(Top\|Bot\|\d\+%\)\s*$', s:get_statusline())
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ func Test_statusline()
|
|||||||
|
|
||||||
" %v: Virtual column number.
|
" %v: Virtual column number.
|
||||||
" %V: Virtual column number as -{num}. Not displayed if equal to 'c'.
|
" %V: Virtual column number as -{num}. Not displayed if equal to 'c'.
|
||||||
call cursor(180, 2)
|
call cursor(9000, 2)
|
||||||
set statusline=%v,%V
|
set statusline=%v,%V
|
||||||
call assert_match('^2,\s*$', s:get_statusline())
|
call assert_match('^2,\s*$', s:get_statusline())
|
||||||
set virtualedit=all
|
set virtualedit=all
|
||||||
@ -195,20 +195,26 @@ func Test_statusline()
|
|||||||
|
|
||||||
" Test min/max width, leading zeroes, left/right justify.
|
" Test min/max width, leading zeroes, left/right justify.
|
||||||
set statusline=%04B
|
set statusline=%04B
|
||||||
call cursor(180, 2)
|
call cursor(9000, 1)
|
||||||
call assert_match('^0038\s*$', s:get_statusline())
|
call assert_match('^0039\s*$', s:get_statusline())
|
||||||
set statusline=#%4B#
|
set statusline=#%4B#
|
||||||
call assert_match('^# 38#\s*$', s:get_statusline())
|
call assert_match('^# 39#\s*$', s:get_statusline())
|
||||||
set statusline=#%-4B#
|
set statusline=#%-4B#
|
||||||
call assert_match('^#38 #\s*$', s:get_statusline())
|
call assert_match('^#39 #\s*$', s:get_statusline())
|
||||||
set statusline=%.6f
|
set statusline=%.6f
|
||||||
call assert_match('^<sline\s*$', s:get_statusline())
|
call assert_match('^<sline\s*$', s:get_statusline())
|
||||||
|
|
||||||
" %<: Where to truncate.
|
" %<: Where to truncate.
|
||||||
exe 'set statusline=a%<b' . repeat('c', 1000) . 'd'
|
" First check with when %< should not truncate with many columns
|
||||||
call assert_match('^a<c*d$', s:get_statusline())
|
exe 'set statusline=a%<b' . repeat('c', &columns - 3) . 'd'
|
||||||
exe 'set statusline=a' . repeat('b', 1000) . '%<c'
|
call assert_match('^abc\+d$', s:get_statusline())
|
||||||
call assert_match('^ab*>$', s:get_statusline())
|
exe 'set statusline=a' . repeat('b', &columns - 2) . '%<c'
|
||||||
|
call assert_match('^ab\+c$', s:get_statusline())
|
||||||
|
" Then check when %< should truncate when there with too few columns.
|
||||||
|
exe 'set statusline=a%<b' . repeat('c', &columns - 2) . 'd'
|
||||||
|
call assert_match('^a<c\+d$', s:get_statusline())
|
||||||
|
exe 'set statusline=a' . repeat('b', &columns - 1) . '%<c'
|
||||||
|
call assert_match('^ab\+>$', s:get_statusline())
|
||||||
|
|
||||||
"%{: Evaluate expression between '%{' and '}' and substitute result.
|
"%{: Evaluate expression between '%{' and '}' and substitute result.
|
||||||
syntax on
|
syntax on
|
||||||
|
Loading…
Reference in New Issue
Block a user