mirror of
https://github.com/vim/vim.git
synced 2026-08-01 18:29:40 +02:00
patch 9.2.0873: :redrawstatus does not update the ruler of the last window
Problem: When the last window has no status line the ruler takes its
place in the last screen line, but ":redrawstatus" and
re-setting 'rulerformat' or 'statusline' do not update it
there. An item such as a clock in 'rulerformat' can therefore
not be refreshed from a timer (watael)
Solution: Also mark the ruler for redrawing when the last window has no
status line and 'ruler' is set. Update the documentation,
tests and add a new test (Hirohito Higashi)
Reported: https://groups.google.com/g/vim_use/c/VKCL2bH8xlk
closes: #20865
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
b34beebd24
commit
430ea72334
@@ -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.
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+1
-1
@@ -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|
|
||||
|
||||
+1
-1
@@ -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|
|
||||
|
||||
@@ -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 <q-args>
|
||||
|
||||
|
||||
@@ -758,6 +758,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
873,
|
||||
/**/
|
||||
872,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user