diff --git a/src/nvim/statusline.c b/src/nvim/statusline.c index cc2a66cdca..93baf16afd 100644 --- a/src/nvim/statusline.c +++ b/src/nvim/statusline.c @@ -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); diff --git a/test/functional/ui/messages2_spec.lua b/test/functional/ui/messages2_spec.lua index 7a611ebadb..d3018f6727 100644 --- a/test/functional/ui/messages2_spec.lua +++ b/test/functional/ui/messages2_spec.lua @@ -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)]]) @@ -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 echo "foo\nbar" ls]]) @@ -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') @@ -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('qixdwi') screen:expect([[ {18:^"} | {1:~ }|*12 - ^R 1,1 All| + ^R 1,1 All| ]]) feed('-') 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('') -- 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('j') screen:expect([[ {10:foo} | ^bar | {1:~ }|*11 - 2,1 All| + 2,1 All| ]]) end) end) diff --git a/test/functional/ui/messages_spec.lua b/test/functional/ui/messages_spec.lua index 89062b9291..7e3928fc35 100644 --- a/test/functional/ui/messages_spec.lua +++ b/test/functional/ui/messages_spec.lua @@ -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('abcde12345') 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('^') 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('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('od') 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({