-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
fix(decor): clamp last column by decor provider range #35587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
For #35575, the issue happened because I rebased incorrectly and used the wrong variable (see: #35575 (comment)), so when window height matched a position on the line with no decorations, the issue occured. Reproduction: -- window height is 5, 9, 11, 13, 15, ...
vim.cmd('set nowrap')
vim.api.nvim_buf_set_lines(0, 0, -1, true, {
'local foo = { { severity = 0 }, { severity = 1 }, { severity = 2 }, { severity = 3 }, { severity = 0 }, { severity = 1 }, { severity = 2 }, { severity = 3 }, { severity = 0 }, { severity = 1 }, { severity = 2 }, { serity = 3 } }'
})
vim.cmd('set ft=lua') UPD: also fixed this |
7e952e9
to
225b480
Compare
@@ -1268,7 +1268,7 @@ static TriState decor_spell_nav_col(win_T *wp, linenr_T lnum, linenr_T *decor_ln | |||
decor_redraw_line(wp, lnum - 1, &decor_state); | |||
*decor_lnum = lnum; | |||
} | |||
decor_redraw_col(wp, col, 0, false, &decor_state); | |||
decor_redraw_col(wp, col, 0, false, &decor_state, MAXCOL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used MAXCOL
here since I think decor_state
is reset afterwards, so the column doesn't affect anything
@@ -792,7 +793,7 @@ int decor_redraw_col_impl(win_T *wp, int col, int win_col, bool hidden, DecorSta | |||
DecorSignHighlight *sh = &r->data.sh; | |||
conceal = 2; | |||
conceal_char = sh->text[0]; | |||
col_until = MIN(col_until, r->start_col); | |||
col_last = MIN(col_last, r->start_col); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this code assumes the character is 1 byte, and this is start_col + char_len - 1
.
Are conceal characters always single byte?
225b480
to
e9a357e
Compare
fixes #35575
Problem:
When decoration provider is invoked and there's no more decorations, it sets
col_until
toMAXCOL
. However, with the addition of range based highlighting, more decorations may be added afterwards, but they would be ignored.Solution:
Use last column of the range of the requested decorations as maximum for
col_until
I also renamed
col_until
tocol_last
since it is not end-exclusive.