-*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
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.
}
#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
*/
wp->w_redr_status = true;
redraw_later(UPD_VALID);
}
+ ruler_redraw_lastwin();
}
/*
wp->w_redr_status = true;
redraw_later(UPD_VALID);
}
+ if (lastwin->w_buffer == curbuf)
+ ruler_redraw_lastwin();
}
/*
|~| @73
|~| @73
|~| @73
-| +0#0000000&@56|0|,|0|-|1| @8|A|l@1|
+| +0#0000000&@56|1|,|1| @10|A|l@1|
|~| @73
|~| @73
|~| @73
-| +0#0000000&@56|0|,|0|-|1| @8|A|l@1|
+| +0#0000000&@56|1|,|1| @10|A|l@1|
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>
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 873,
/**/
872,
/**/