aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2023-04-17 17:32:32 +0100
committerSean Dewar <seandewar@users.noreply.github.com>2023-04-17 18:38:31 +0100
commit7095f8ff9d9ce3519abe34a3da4c8f4bdc3fc865 (patch)
treeb5dbcc244f5ae81581cbc77cd6d9309717dba9e3 /src
parent9e5f9c25d9955f8c0ab7de874cf3a40fc077458b (diff)
downloadrneovim-7095f8ff9d9ce3519abe34a3da4c8f4bdc3fc865.tar.gz
rneovim-7095f8ff9d9ce3519abe34a3da4c8f4bdc3fc865.tar.bz2
rneovim-7095f8ff9d9ce3519abe34a3da4c8f4bdc3fc865.zip
vim-patch:9.0.1461: ruler not drawn correctly when using 'rulerformat'
Problem: Ruler not drawn correctly when using 'rulerformat'. Solution: Adjust formatting depending on whether the ruler is drawn in the statusline or the command line. (Sean Dewar, closes vim/vim#12246) https://github.com/vim/vim/commit/fc8a601c3251c0388a88c1235b18c529385f7196 This issue was made apparent after neovim/neovim@0f1e2b6, as `showmode()` calls `win_redr_ruler()` with `curwin` now if it's floating, rather than the last window if there's no statusline (which usually already shares its right side with that of the editor). Co-authored-by: Sean Dewar <seandewar@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r--src/nvim/statusline.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/nvim/statusline.c b/src/nvim/statusline.c
index feb67ad6fa..5a1f7e3a7f 100644
--- a/src/nvim/statusline.c
+++ b/src/nvim/statusline.c
@@ -348,7 +348,8 @@ static void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler)
} else {
row = is_stl_global ? (Rows - (int)p_ch - 1) : W_ENDROW(wp);
fillchar = fillchar_status(&attr, wp);
- maxwidth = is_stl_global ? Columns : wp->w_width;
+ const bool in_status_line = wp->w_status_height != 0 || is_stl_global;
+ maxwidth = in_status_line && !is_stl_global ? wp->w_width : Columns;
stl_clear_click_defs(wp->w_status_click_defs, wp->w_status_click_defs_size);
wp->w_status_click_defs = stl_alloc_click_defs(wp->w_status_click_defs, maxwidth,
&wp->w_status_click_defs_size);
@@ -374,8 +375,8 @@ static void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler)
if (col < (maxwidth + 1) / 2) {
col = (maxwidth + 1) / 2;
}
- maxwidth = maxwidth - col;
- if (!wp->w_status_height && !is_stl_global) {
+ maxwidth -= col;
+ if (!in_status_line) {
grid = &msg_grid_adj;
row = Rows - 1;
maxwidth--; // writing in last column may cause scrolling
@@ -388,7 +389,9 @@ static void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler)
opt_scope = ((*wp->w_p_stl != NUL) ? OPT_LOCAL : 0);
}
- col += is_stl_global ? 0 : wp->w_wincol;
+ if (in_status_line && !is_stl_global) {
+ col += wp->w_wincol;
+ }
}
if (maxwidth <= 0) {