aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuuk van Baal <luukvbaal@gmail.com>2023-04-01 03:11:56 +0200
committerLuuk van Baal <luukvbaal@gmail.com>2023-04-02 15:24:55 +0200
commitc8a28b847e2b814b44fe77b46f7f4564ab59f0ac (patch)
tree2200f8f4cfd76ee26da70f5dcae840aa6ac90577
parent3a4db8154ff043f044ab18d5fced42bffb1002fd (diff)
downloadrneovim-c8a28b847e2b814b44fe77b46f7f4564ab59f0ac.tar.gz
rneovim-c8a28b847e2b814b44fe77b46f7f4564ab59f0ac.tar.bz2
rneovim-c8a28b847e2b814b44fe77b46f7f4564ab59f0ac.zip
fix(ui): ruler is not redrawn in cmdline with redrawstatus
-rw-r--r--runtime/doc/various.txt3
-rw-r--r--src/nvim/drawscreen.c5
-rw-r--r--test/functional/ui/statusline_spec.lua17
3 files changed, 24 insertions, 1 deletions
diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt
index 8244ae4230..7b0e724e31 100644
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -32,7 +32,8 @@ CTRL-L Clears and redraws the screen. The redraw may happen
*:redraws* *:redrawstatus*
:redraws[tatus][!] Redraws the status line and window bar of the current
window, or all status lines and window bars if "!" is
- included. Useful if 'statusline' or 'winbar' includes
+ included. Redraws the commandline instead if it contains
+ the 'ruler'. Useful if 'statusline' or 'winbar' includes
an item that doesn't cause automatic updating.
*:redrawt* *:redrawtabline*
diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c
index f90a41c406..5ced55b2c7 100644
--- a/src/nvim/drawscreen.c
+++ b/src/nvim/drawscreen.c
@@ -2683,6 +2683,11 @@ 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
+ if (p_ru && !curwin->w_status_height && !curwin->w_redr_status) {
+ redraw_cmdline = true;
+ redraw_later(curwin, UPD_VALID);
+ }
}
/// Redraw all status lines that need to be redrawn.
diff --git a/test/functional/ui/statusline_spec.lua b/test/functional/ui/statusline_spec.lua
index ffd45a59a3..8e301dc70c 100644
--- a/test/functional/ui/statusline_spec.lua
+++ b/test/functional/ui/statusline_spec.lua
@@ -636,3 +636,20 @@ it('statusline is redrawn on recording state change #22683', function()
recording @Q |
]])
end)
+
+it('ruler is redrawn in cmdline with redrawstatus #22804', function()
+ clear()
+ local screen = Screen.new(40, 2)
+ screen:attach()
+ command([[
+ let g:n = 'initial value'
+ set ls=1 ru ruf=%{g:n}
+ redraw
+ let g:n = 'other value'
+ redrawstatus
+ ]])
+ screen:expect([[
+ ^ |
+ other value |
+ ]])
+end)