aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/drawscreen.c8
-rw-r--r--test/functional/ui/messages2_spec.lua19
2 files changed, 24 insertions, 3 deletions
diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c
index e376a4d135..eb4a1a3fd8 100644
--- a/src/nvim/drawscreen.c
+++ b/src/nvim/drawscreen.c
@@ -2741,7 +2741,7 @@ void redraw_buf_range_later(buf_T *buf, linenr_T first, linenr_T last)
}
}
-/// called when the status bars for the buffer 'buf' need to be updated
+/// Marks the statuslines, 'winbar' and cmdline ruler of `buf` for redraw.
void redraw_buf_status_later(buf_T *buf)
{
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
@@ -2753,6 +2753,10 @@ void redraw_buf_status_later(buf_T *buf)
set_must_redraw(UPD_VALID);
}
}
+ // Redraw 'ruler' if it is in cmdline (e.g. 'laststatus=0') and was not marked for redraw above.
+ if (p_ru && curwin->w_buffer == buf && !curwin->w_status_height && !curwin->w_redr_status) {
+ redraw_cmdline = true;
+ }
}
/// Mark all status lines and window bars for redraw; used after first :cd
@@ -2787,7 +2791,7 @@ void status_redraw_buf(buf_T *buf)
redraw_later(wp, UPD_VALID);
}
}
- // Redraw the ruler if it is in the command line and was not marked for redraw above
+ // Redraw 'ruler' if it is in cmdline (e.g. 'laststatus=0') and was not marked for redraw above.
if (p_ru && !curwin->w_status_height && !curwin->w_redr_status) {
redraw_cmdline = true;
redraw_later(curwin, UPD_VALID);
diff --git a/test/functional/ui/messages2_spec.lua b/test/functional/ui/messages2_spec.lua
index b79db68af8..3f8168ca95 100644
--- a/test/functional/ui/messages2_spec.lua
+++ b/test/functional/ui/messages2_spec.lua
@@ -1306,7 +1306,7 @@ describe('messages2', function()
]])
end)
- it('crops long messages to make place for ruler', function()
+ it("'ruler' placement truncates long messages", function()
command('set noruler | echo "-"->repeat(&columns)')
screen:expect([[
^ |
@@ -1405,6 +1405,23 @@ describe('messages2', function()
]])
end)
+ it("'ruler' updates on 'modified' change #42255", function()
+ command('set laststatus=0 ruler rulerformat=%m noautoread')
+ command(('edit %s'):format(t.tmpname(false)))
+ feed('ihello<Esc>')
+ screen:expect([[
+ hell^o |
+ {1:~ }|*12
+ [+]|
+ ]])
+ command('silent write')
+ screen:expect([[
+ hell^o |
+ {1:~ }|*12
+ |
+ ]])
+ end)
+
it('pager statusline is not clobbered by DiagnosticChanged redraw #41130', function()
exec_lua(function()
vim.o.laststatus = 3