mirror of
https://github.com/neovim/neovim.git
synced 2025-10-08 02:46:31 +00:00
fix(ruler): show ruler of curwin with no statusline in cmdline
Problem: After neovim/neovim@846a056, only the ruler for current floating or last window without a statusline is drawn in the cmdline. This means that if the current window is not one of these, but has no statusline, its ruler will not be drawn anymore. Solution: Make `showmode()` draw the ruler of the current window or the last window in the cmdline if it has no statusline. This also maintains the previously restored floating window case (`float->w_status_height` should be 0). This behaviour should again match Vim, but without the overdraw it seems to do to achieve the same effect; it calls `showmode()` to draw the ruler for the last window without a statusline, then may draw over it in `showruler()` (which is now `show_cursor_info_later()` in Nvim) to show the ruler for the current window..? It's very confusing. Also update the logic in `win_redr_ruler()` to mirror the check done in `showmode()`, so that the ruler doesn't potentially draw over the long ins-completion mode message in some cases.
This commit is contained in:
@@ -1052,11 +1052,11 @@ int showmode(void)
|
||||
clear_showcmd();
|
||||
}
|
||||
|
||||
// If the last window has no status line and global statusline is disabled,
|
||||
// If the current or last window has no status line and global statusline is disabled,
|
||||
// the ruler is after the mode message and must be redrawn
|
||||
win_T *last = curwin->w_floating ? curwin : lastwin_nofloating();
|
||||
if (redrawing() && last->w_status_height == 0 && global_stl_height() == 0) {
|
||||
win_redr_ruler(last);
|
||||
win_T *ruler_win = curwin->w_status_height == 0 ? curwin : lastwin_nofloating();
|
||||
if (redrawing() && ruler_win->w_status_height == 0 && global_stl_height() == 0) {
|
||||
win_redr_ruler(ruler_win);
|
||||
}
|
||||
|
||||
redraw_cmdline = false;
|
||||
|
@@ -497,7 +497,8 @@ void win_redr_ruler(win_T *wp)
|
||||
|
||||
// Don't draw the ruler while doing insert-completion, it might overwrite
|
||||
// the (long) mode message.
|
||||
if (wp == lastwin && lastwin->w_status_height == 0 && !is_stl_global) {
|
||||
win_T *ruler_win = curwin->w_status_height == 0 ? curwin : lastwin_nofloating();
|
||||
if (wp == ruler_win && ruler_win->w_status_height == 0 && !is_stl_global) {
|
||||
if (edit_submode != NULL) {
|
||||
return;
|
||||
}
|
||||
@@ -510,7 +511,7 @@ void win_redr_ruler(win_T *wp)
|
||||
|
||||
// Check if not in Insert mode and the line is empty (will show "0-1").
|
||||
int empty_line = (State & MODE_INSERT) == 0
|
||||
&& *ml_get_buf(curwin->w_buffer, curwin->w_cursor.lnum, false) == NUL;
|
||||
&& *ml_get_buf(wp->w_buffer, wp->w_cursor.lnum, false) == NUL;
|
||||
|
||||
int width;
|
||||
int row;
|
||||
|
Reference in New Issue
Block a user