mirror of
https://github.com/neovim/neovim.git
synced 2026-07-17 22:51:20 +00:00
fix(ui2)!: consistent ruler width inside/outside statusline
Problem: before ui2, the ruler in the last line had a one cell safety margin on the right because writing in the last column of the last line "scrolls the screen up on some terminals," according to code comments. When the ruler is included in the statusline, it aligns on the left with the normal ruler, but goes all the way to the screen edge on the right, and is therefore one cell longer. Since ui2 doesn't have that padding cell, they don't align anymore. Also, in the future, when the C implementation of the ruler will be replaced with a default expression that will be included in the default statusline (currently `%-14.(%l,%c%V%) %P`), the width will naturally be the same in both places, and the unit tests will need adapting anyway. Solution: when ui2 is active, increase the ruler width by 1. BREAKING CHANGE: the default ruler in ui2 is now 1 cell wider. ref https://github.com/neovim/neovim/issues/40247
This commit is contained in:
@@ -553,8 +553,8 @@ void redraw_ruler(void)
|
||||
char rel_pos[RULER_BUF_LEN];
|
||||
int rel_poslen = get_rel_pos(wp, rel_pos, RULER_BUF_LEN);
|
||||
int n1 = bufferlen + vim_strsize(rel_pos);
|
||||
if (wp->w_status_height == 0 && !is_stl_global) { // can't use last char of screen
|
||||
n1++;
|
||||
if (wp->w_status_height == 0 && !is_stl_global && !ui_has(kUIMessages)) {
|
||||
n1++; // can't use last char of screen
|
||||
}
|
||||
|
||||
int this_ru_col = ru_col - (Columns - width);
|
||||
|
||||
@@ -62,7 +62,7 @@ describe('messages2', function()
|
||||
{3: }|
|
||||
^foo |
|
||||
bar |
|
||||
1,1 All|
|
||||
1,1 All|
|
||||
]])
|
||||
-- Multiple messages in same event loop iteration are appended and shown in full.
|
||||
feed([[q:echo "foo" | echo "bar\nbaz\n"->repeat(&lines)<CR>]])
|
||||
@@ -86,21 +86,21 @@ describe('messages2', function()
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|*12
|
||||
foo 0,0-1 All|
|
||||
foo 0,0-1 All|
|
||||
]])
|
||||
command('echo "foo"')
|
||||
-- Ruler still positioned correctly after dupe message.
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|*12
|
||||
foo(1) 0,0-1 All|
|
||||
foo(1) 0,0-1 All|
|
||||
]])
|
||||
command('echo "foo"')
|
||||
-- Dupe counter increases beyond 1
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|*12
|
||||
foo(2) 0,0-1 All|
|
||||
foo(2) 0,0-1 All|
|
||||
]])
|
||||
-- No error for ruler virt_text msg_row exceeding buffer length.
|
||||
command([[map Q <cmd>echo "foo\nbar" <bar> ls<CR>]])
|
||||
@@ -117,7 +117,7 @@ describe('messages2', function()
|
||||
screen:expect([[
|
||||
^ |
|
||||
{1:~ }|*12
|
||||
0,0-1 All|
|
||||
0,0-1 All|
|
||||
]])
|
||||
-- g< shows messages from last command
|
||||
feed('g<lt>')
|
||||
@@ -128,20 +128,20 @@ describe('messages2', function()
|
||||
^foo |
|
||||
bar |
|
||||
1 %a "[No Name]" line 1 |
|
||||
1,1 All|
|
||||
1,1 All|
|
||||
]])
|
||||
-- edit_unputchar() does not clear already updated screen #34515.
|
||||
feed('qix<Esc>dwi<C-r>')
|
||||
screen:expect([[
|
||||
{18:^"} |
|
||||
{1:~ }|*12
|
||||
^R 1,1 All|
|
||||
^R 1,1 All|
|
||||
]])
|
||||
feed('-<Esc>')
|
||||
screen:expect([[
|
||||
^x |
|
||||
{1:~ }|*12
|
||||
1,1 All|
|
||||
1,1 All|
|
||||
]])
|
||||
-- Switching tabpage closes expanded cmdline #37659.
|
||||
command('tabnew | echo "foo\nbar"')
|
||||
@@ -158,7 +158,7 @@ describe('messages2', function()
|
||||
{5: + [No Name] }{24: [No Name] }{2: }{24:X}|
|
||||
^x |
|
||||
{1:~ }|*11
|
||||
foo [+1] 1,1 All|
|
||||
foo [+1] 1,1 All|
|
||||
]])
|
||||
-- Don't enter the pager in insert mode.
|
||||
command('tabonly | call nvim_echo([["foo\n"]]->repeat(&lines), 1, {}) | startinsert')
|
||||
@@ -174,7 +174,7 @@ describe('messages2', function()
|
||||
|
|
||||
^x |
|
||||
{1:~ }|*11
|
||||
foo [+14] 2,1 All|
|
||||
foo [+14] 2,1 All|
|
||||
]])
|
||||
feed('<BS><Esc>')
|
||||
-- First multiline message expands cmdline, additional message updates spill indicator.
|
||||
@@ -192,7 +192,7 @@ describe('messages2', function()
|
||||
screen:expect([[
|
||||
^foo |
|
||||
foo |*12
|
||||
1,1 Top|
|
||||
1,1 Top|
|
||||
]])
|
||||
-- Changing 'laststatus' reveals the global statusline with a pager height
|
||||
-- exceeding the available lines: #38008.
|
||||
@@ -1098,14 +1098,14 @@ describe('messages2', function()
|
||||
{10:^foo} |
|
||||
bar |
|
||||
{1:~ }|*11
|
||||
/foo W [1/1] 1,1 All|
|
||||
/foo W [1/1] 1,1 All|
|
||||
]])
|
||||
feed('<C-L>j')
|
||||
screen:expect([[
|
||||
{10:foo} |
|
||||
^bar |
|
||||
{1:~ }|*11
|
||||
2,1 All|
|
||||
2,1 All|
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
||||
@@ -941,7 +941,7 @@ describe('ui/ext_messages', function()
|
||||
^ |
|
||||
{1:~ }|*4
|
||||
]],
|
||||
ruler = { { '0,0-1 All', 9, 'MsgArea' } },
|
||||
ruler = { { '0,0-1 All', 9, 'MsgArea' } },
|
||||
})
|
||||
command('hi clear MsgArea')
|
||||
feed('i')
|
||||
@@ -951,7 +951,7 @@ describe('ui/ext_messages', function()
|
||||
{1:~ }|*4
|
||||
]],
|
||||
showmode = { { '-- INSERT --', 5, 'ModeMsg' } },
|
||||
ruler = { { '0,1 All', 'MsgArea' } },
|
||||
ruler = { { '0,1 All', 'MsgArea' } },
|
||||
}
|
||||
feed('abcde<cr>12345<esc>')
|
||||
screen:expect {
|
||||
@@ -960,7 +960,7 @@ describe('ui/ext_messages', function()
|
||||
1234^5 |
|
||||
{1:~ }|*3
|
||||
]],
|
||||
ruler = { { '2,5 All', 'MsgArea' } },
|
||||
ruler = { { '2,5 All', 'MsgArea' } },
|
||||
}
|
||||
feed('d')
|
||||
screen:expect {
|
||||
@@ -970,7 +970,7 @@ describe('ui/ext_messages', function()
|
||||
{1:~ }|*3
|
||||
]],
|
||||
showcmd = { { 'd' } },
|
||||
ruler = { { '2,5 All', 'MsgArea' } },
|
||||
ruler = { { '2,5 All', 'MsgArea' } },
|
||||
}
|
||||
feed('<esc>^')
|
||||
screen:expect {
|
||||
@@ -979,7 +979,7 @@ describe('ui/ext_messages', function()
|
||||
^12345 |
|
||||
{1:~ }|*3
|
||||
]],
|
||||
ruler = { { '2,1 All', 'MsgArea' } },
|
||||
ruler = { { '2,1 All', 'MsgArea' } },
|
||||
}
|
||||
feed('<c-v>k2l')
|
||||
screen:expect({
|
||||
@@ -990,7 +990,7 @@ describe('ui/ext_messages', function()
|
||||
]],
|
||||
showmode = { { '-- VISUAL BLOCK --', 5, 'ModeMsg' } },
|
||||
showcmd = { { '2x3' } },
|
||||
ruler = { { '1,3 All', 'MsgArea' } },
|
||||
ruler = { { '1,3 All', 'MsgArea' } },
|
||||
})
|
||||
feed('o<esc>d')
|
||||
screen:expect {
|
||||
@@ -1000,7 +1000,7 @@ describe('ui/ext_messages', function()
|
||||
{1:~ }|*3
|
||||
]],
|
||||
showcmd = { { 'd' } },
|
||||
ruler = { { '2,1 All', 'MsgArea' } },
|
||||
ruler = { { '2,1 All', 'MsgArea' } },
|
||||
}
|
||||
feed('i')
|
||||
screen:expect {
|
||||
@@ -1010,7 +1010,7 @@ describe('ui/ext_messages', function()
|
||||
{1:~ }|*3
|
||||
]],
|
||||
showcmd = { { 'di' } },
|
||||
ruler = { { '2,1 All', 'MsgArea' } },
|
||||
ruler = { { '2,1 All', 'MsgArea' } },
|
||||
}
|
||||
feed('w')
|
||||
screen:expect {
|
||||
@@ -1019,7 +1019,7 @@ describe('ui/ext_messages', function()
|
||||
^ |
|
||||
{1:~ }|*3
|
||||
]],
|
||||
ruler = { { '2,0-1 All', 'MsgArea' } },
|
||||
ruler = { { '2,0-1 All', 'MsgArea' } },
|
||||
}
|
||||
command('set rulerformat=Foo%#ErrorMsg#Bar')
|
||||
screen:expect({
|
||||
|
||||
Reference in New Issue
Block a user