fix(ruler): no window-local highlights for last line 'rulerformat'

Fixes #38777 in case 'rulerformat' is set.

See PR 38879. Original message:
Problem:  When the 'ruler' is in the last line of the screen, it takes
          local highlight definitions of the current window, tripping an
          assert (since c1648cf).
Solution: Don't use window-local highlight definitions when the ruler is
          not part of a statusline.
This commit is contained in:
Sébastien Hoffmann
2026-07-25 14:48:14 +02:00
parent 8d2b50c0ce
commit dc21aa07f7
2 changed files with 10 additions and 1 deletions

View File

@@ -348,7 +348,7 @@ static void win_redr_stl_expr(win_T *wp, bool draw_winbar, bool draw_ruler, bool
opt_scope = ((*wp->w_p_stl != NUL) ? OPT_LOCAL : 0);
}
attr = win_hl_attr(wp, (int)group);
attr = draw_ruler && !in_status_line ? HL_ATTR(group) : win_hl_attr(wp, (int)group);
if (!wp->w_floating && in_status_line && !is_stl_global) {
col += wp->w_wincol;
}

View File

@@ -818,6 +818,15 @@ describe('statusline', function()
{2:[No Name] 0,0-1 All}|
0,0-1 All |
]])
command('set rulerformat=%17(%l,%c%V%=%P%)')
screen:expect([[
|
{1:~}{15:^ }{1: }|
{1:~ }|*4
{2:[No Name] 0,0-1 All}|
0,0-1 All |
]])
command('set rulerformat&')
api.nvim_win_close(win, true)
screen:expect([[
^ |