diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index 4a4bd69554..0a5ff259ca 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -1,4 +1,4 @@ -*various.txt* For Vim version 9.2. Last change: 2026 Jun 13 +*various.txt* For Vim version 9.2. Last change: 2026 Jul 29 VIM REFERENCE MANUAL by Bram Moolenaar @@ -28,6 +28,9 @@ CTRL-L Clear and redraw the screen. The redraw may happen Useful to update the status line(s) when 'statusline' includes an item that doesn't cause automatic updating. + When the last window has no status line the ruler is + redrawn instead, this is useful when 'rulerformat' + includes such an item. If the command line is being edited the redraw is postponed until later. diff --git a/src/drawscreen.c b/src/drawscreen.c index 2c932d4ba7..a5b3124212 100644 --- a/src/drawscreen.c +++ b/src/drawscreen.c @@ -3477,6 +3477,17 @@ redraw_buf_and_status_later(buf_T *buf, int type) } #endif +/* + * mark the ruler for redraw when the last window has no status line and the + * ruler takes its place in the last screen line; showmode() draws it + */ + static void +ruler_redraw_lastwin(void) +{ + if (p_ru && lastwin->w_status_height == 0) + redraw_cmdline = TRUE; +} + /* * mark all status lines for redraw; used after first :cd */ @@ -3491,6 +3502,7 @@ status_redraw_all(void) wp->w_redr_status = true; redraw_later(UPD_VALID); } + ruler_redraw_lastwin(); } /* @@ -3507,6 +3519,8 @@ status_redraw_curbuf(void) wp->w_redr_status = true; redraw_later(UPD_VALID); } + if (lastwin->w_buffer == curbuf) + ruler_redraw_lastwin(); } /* diff --git a/src/testdir/dumps/Test_terminal_focus_1.dump b/src/testdir/dumps/Test_terminal_focus_1.dump index caf67e71af..94097b92c4 100644 --- a/src/testdir/dumps/Test_terminal_focus_1.dump +++ b/src/testdir/dumps/Test_terminal_focus_1.dump @@ -3,4 +3,4 @@ |~| @73 |~| @73 |~| @73 -| +0#0000000&@56|0|,|0|-|1| @8|A|l@1| +| +0#0000000&@56|1|,|1| @10|A|l@1| diff --git a/src/testdir/dumps/Test_terminal_focus_2.dump b/src/testdir/dumps/Test_terminal_focus_2.dump index d02c1515f3..195dbad898 100644 --- a/src/testdir/dumps/Test_terminal_focus_2.dump +++ b/src/testdir/dumps/Test_terminal_focus_2.dump @@ -3,4 +3,4 @@ |~| @73 |~| @73 |~| @73 -| +0#0000000&@56|0|,|0|-|1| @8|A|l@1| +| +0#0000000&@56|1|,|1| @10|A|l@1| diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim index ef036d2b03..a83dcb973c 100644 --- a/src/testdir/test_cmdline.vim +++ b/src/testdir/test_cmdline.vim @@ -4693,6 +4693,32 @@ func Test_rulerformat_function() call StopVimInTerminal(buf) endfunc +func s:BumpRulerCounter(timer) + let g:ruler_counter = 2 + redrawstatus +endfunc + +" When the last window has no status line the ruler is drawn in the last +" screen line. ":redrawstatus" must update it there as well. +func Test_rulerformat_redrawstatus() + CheckFeature timers + + let save_ruf = &rulerformat + set ruler laststatus=0 + let g:ruler_counter = 1 + set rulerformat=%20(count:\ %{g:ruler_counter}%) + redraw! + call assert_match('count: 1', Screenline(&lines)) + + " The ruler must be updated without any key being typed. + call timer_start(10, function('s:BumpRulerCounter')) + call WaitForAssert({-> assert_match('count: 2', Screenline(&lines))}) + + let &rulerformat = save_ruf + unlet g:ruler_counter + set ruler& laststatus& +endfunc + func Test_getcompletion_usercmd() command! -nargs=* -complete=command TestCompletion echo diff --git a/src/version.c b/src/version.c index c7eac10f8f..1f78ca0d85 100644 --- a/src/version.c +++ b/src/version.c @@ -758,6 +758,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 873, /**/ 872, /**/