mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 11:28:22 +00:00
fix(extmarks): empty inline virt_text interfering with Visual highlight
This commit is contained in:
@@ -869,7 +869,7 @@ static void apply_cursorline_highlight(win_T *wp, winlinevars_T *wlv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_inline_virtual_text(win_T *wp, winlinevars_T *wlv, ptrdiff_t v, bool *do_save)
|
static void handle_inline_virtual_text(win_T *wp, winlinevars_T *wlv, ptrdiff_t v)
|
||||||
{
|
{
|
||||||
while (wlv->n_extra == 0) {
|
while (wlv->n_extra == 0) {
|
||||||
if (wlv->virt_inline_i >= kv_size(wlv->virt_inline)) {
|
if (wlv->virt_inline_i >= kv_size(wlv->virt_inline)) {
|
||||||
@@ -905,7 +905,6 @@ static void handle_inline_virtual_text(win_T *wp, winlinevars_T *wlv, ptrdiff_t
|
|||||||
wlv->extra_attr = vtc.hl_id ? syn_id2attr(vtc.hl_id) : 0;
|
wlv->extra_attr = vtc.hl_id ? syn_id2attr(vtc.hl_id) : 0;
|
||||||
wlv->n_attr = mb_charlen(vtc.text);
|
wlv->n_attr = mb_charlen(vtc.text);
|
||||||
wlv->virt_inline_i++;
|
wlv->virt_inline_i++;
|
||||||
*do_save = true;
|
|
||||||
// If the text didn't reach until the first window
|
// If the text didn't reach until the first window
|
||||||
// column we need to skip cells.
|
// column we need to skip cells.
|
||||||
if (wlv->skip_cells > 0) {
|
if (wlv->skip_cells > 0) {
|
||||||
@@ -1795,9 +1794,8 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool number_onl
|
|||||||
extmark_attr = decor_redraw_col(wp, (colnr_T)v, wlv.off, selected, &decor_state);
|
extmark_attr = decor_redraw_col(wp, (colnr_T)v, wlv.off, selected, &decor_state);
|
||||||
|
|
||||||
if (!has_fold) {
|
if (!has_fold) {
|
||||||
bool do_save = false;
|
handle_inline_virtual_text(wp, &wlv, v);
|
||||||
handle_inline_virtual_text(wp, &wlv, v, &do_save);
|
if (wlv.n_extra > 0) {
|
||||||
if (do_save) {
|
|
||||||
// restore search_attr and area_attr when n_extra is down to zero
|
// restore search_attr and area_attr when n_extra is down to zero
|
||||||
// TODO(bfredl): this is ugly as fuck. look if we can do this some other way.
|
// TODO(bfredl): this is ugly as fuck. look if we can do this some other way.
|
||||||
saved_search_attr = search_attr;
|
saved_search_attr = search_attr;
|
||||||
|
@@ -1675,9 +1675,11 @@ describe('decorations: inline virtual text', function()
|
|||||||
|
|
|
|
||||||
]]}
|
]]}
|
||||||
|
|
||||||
|
meths.buf_set_extmark(0, ns, 0, 5, {virt_text={{''}, {''}}, virt_text_pos='inline'})
|
||||||
meths.buf_set_extmark(0, ns, 1, 14, {virt_text={{''}, {': ', 'Special'}, {'string', 'Type'}}, virt_text_pos='inline'})
|
meths.buf_set_extmark(0, ns, 1, 14, {virt_text={{''}, {': ', 'Special'}, {'string', 'Type'}}, virt_text_pos='inline'})
|
||||||
|
feed('V')
|
||||||
screen:expect{grid=[[
|
screen:expect{grid=[[
|
||||||
^for _,item in ipairs(items) do |
|
^f{7:or _,item in ipairs(items) do} |
|
||||||
local text{10:: }{3:string}, hl_id_cell, count = unpack|
|
local text{10:: }{3:string}, hl_id_cell, count = unpack|
|
||||||
(item) |
|
(item) |
|
||||||
if hl_id_cell ~= nil then |
|
if hl_id_cell ~= nil then |
|
||||||
@@ -1686,10 +1688,10 @@ describe('decorations: inline virtual text', function()
|
|||||||
for _ = 1, (count or 1) do |
|
for _ = 1, (count or 1) do |
|
||||||
local cell = line[colpos] |
|
local cell = line[colpos] |
|
||||||
cell.text = text |
|
cell.text = text |
|
||||||
|
|
{8:-- VISUAL LINE --} |
|
||||||
]]}
|
]]}
|
||||||
|
|
||||||
feed('jf,')
|
feed('<Esc>jf,')
|
||||||
screen:expect{grid=[[
|
screen:expect{grid=[[
|
||||||
for _,item in ipairs(items) do |
|
for _,item in ipairs(items) do |
|
||||||
local text{10:: }{3:string}^, hl_id_cell, count = unpack|
|
local text{10:: }{3:string}^, hl_id_cell, count = unpack|
|
||||||
|
Reference in New Issue
Block a user