Skip to content

Commit 4976d8b

Browse files
MeanderingProgrammerlewis6991
authored andcommitted
fix: ignore win_col virt_text_pos value when copying extmarks
When setting extmarks the win_col virt_text_pos value is invalid, however it is returned in details whenever an extmark is created with some virt_text_win_col. Handle this case by setting the value to nil.
1 parent 5c48b8b commit 4976d8b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lua/treesitter-context/render.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,11 @@ local function copy_extmarks(bufnr, ctx_bufnr, contexts)
419419
end_row = offset + (mend_row - ctx_srow)
420420
end
421421

422+
local virt_text_pos = opts.virt_text_pos
423+
if virt_text_pos == 'win_col' then
424+
virt_text_pos = nil
425+
end
426+
422427
-- Use pcall incase fields from opts are inconsistent with opts in
423428
-- nvim_buf_set_extmark
424429
pcall(add_extmark, ctx_bufnr, start_row, col, {
@@ -433,7 +438,7 @@ local function copy_extmarks(bufnr, ctx_bufnr, contexts)
433438
hl_eol = opts.hl_eol,
434439
virt_text = opts.virt_text,
435440
virt_text_hide = opts.virt_text_hide,
436-
virt_text_pos = opts.virt_text_pos,
441+
virt_text_pos = virt_text_pos,
437442
virt_text_repeat_linebreak = opts.virt_text_repeat_linebreak,
438443
virt_text_win_col = opts.virt_text_win_col,
439444
hl_mode = opts.hl_mode,

0 commit comments

Comments
 (0)