mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 8.2.4929: off-by-one error in in statusline item
Problem: Off-by-one error in in statusline item. Solution: Subtrace one less. (closes #10394, closes #5599)
This commit is contained in:
@@ -4446,7 +4446,8 @@ build_stl_str_hl(
|
|||||||
// correct the start of the items for the truncation
|
// correct the start of the items for the truncation
|
||||||
for (l = stl_groupitem[groupdepth] + 1; l < curitem; l++)
|
for (l = stl_groupitem[groupdepth] + 1; l < curitem; l++)
|
||||||
{
|
{
|
||||||
stl_items[l].stl_start -= n;
|
// Minus one for the leading '<' added above.
|
||||||
|
stl_items[l].stl_start -= n - 1;
|
||||||
if (stl_items[l].stl_start < t)
|
if (stl_items[l].stl_start < t)
|
||||||
stl_items[l].stl_start = t;
|
stl_items[l].stl_start = t;
|
||||||
}
|
}
|
||||||
|
6
src/testdir/dumps/Test_statusline_hl.dump
Normal file
6
src/testdir/dumps/Test_statusline_hl.dump
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
> +0&#ffffff0@74
|
||||||
|
|~+0#4040ff13&| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|<+0#ffffff16#e000002|F|G+0#0000e05#ffffff0|H|I| @69
|
||||||
|
| +0#0000000&@74
|
@@ -469,7 +469,6 @@ func Test_statusline_removed_group()
|
|||||||
call writefile(lines, 'XTest_statusline')
|
call writefile(lines, 'XTest_statusline')
|
||||||
|
|
||||||
let buf = RunVimInTerminal('-S XTest_statusline', {'rows': 10, 'cols': 50})
|
let buf = RunVimInTerminal('-S XTest_statusline', {'rows': 10, 'cols': 50})
|
||||||
call TermWait(buf, 50)
|
|
||||||
call VerifyScreenDump(buf, 'Test_statusline_1', {})
|
call VerifyScreenDump(buf, 'Test_statusline_1', {})
|
||||||
|
|
||||||
" clean up
|
" clean up
|
||||||
@@ -541,4 +540,22 @@ func Test_statusline_verylong_filename()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_statusline_highlight_truncate()
|
||||||
|
CheckScreendump
|
||||||
|
|
||||||
|
let lines =<< trim END
|
||||||
|
set laststatus=2
|
||||||
|
hi! link User1 Directory
|
||||||
|
hi! link User2 ErrorMsg
|
||||||
|
set statusline=%.5(%1*ABC%2*DEF%1*GHI%)
|
||||||
|
END
|
||||||
|
call writefile(lines, 'XTest_statusline')
|
||||||
|
|
||||||
|
let buf = RunVimInTerminal('-S XTest_statusline', {'rows': 6})
|
||||||
|
call VerifyScreenDump(buf, 'Test_statusline_hl', {})
|
||||||
|
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
call delete('XTest_statusline')
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@@ -746,6 +746,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
4929,
|
||||||
/**/
|
/**/
|
||||||
4928,
|
4928,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user