do not check sub-modes in get_tags_at
All checks were successful
NeoVim tests / code-quality (push) Successful in 1m20s

cull test-dependency
This commit is contained in:
2025-09-13 08:36:33 -06:00
parent 6785398c96
commit f1e225cba9
3 changed files with 17 additions and 11 deletions

View File

@@ -340,7 +340,9 @@ function Renderer:_expr_map_callback(mode, lhs) -- {{{
-- find the tag with the smallest intersection that contains the cursor:
local pos0 = vim.api.nvim_win_get_cursor(0)
pos0[1] = pos0[1] - 1 -- make it actually 0-based
log('_expr_map_callback: pos0:', pos0)
local pos_infos = self:get_tags_at(pos0)
log('_expr_map_callback: pos_infos:', pos_infos)
if #pos_infos == 0 then return lhs end
@@ -538,21 +540,26 @@ end -- }}}
function Renderer:get_tags_at(pos0, mode) -- {{{
local cursor_line0, cursor_col0 = pos0[1], pos0[2]
if not mode then mode = vim.api.nvim_get_mode().mode end
mode = mode:sub(1, 1) -- we don't care about sub-modes
local raw_overlapping_extmarks = vim.api.nvim_buf_get_extmarks(
self.bufnr,
self.ns,
pos0,
pos0,
{ details = true, overlap = true }
)
log(
'get_tags_at: context:',
{ pos0 = pos0, mode = mode, raw_overlapping_extmarks = raw_overlapping_extmarks }
)
-- The cursor (block) occupies **two** extmark spaces: one for it's left
-- edge, and one for it's right. We need to do our own intersection test,
-- because the NeoVim API is over-inclusive in what it returns:
--- @type u.renderer.RendererExtmark[]
local mapped_extmarks = vim
.iter(
vim.api.nvim_buf_get_extmarks(
self.bufnr,
self.ns,
pos0,
pos0,
{ details = true, overlap = true }
)
)
.iter(raw_overlapping_extmarks)
--- @return u.renderer.RendererExtmark
:map(function(ext)
--- @type number, number, number, { end_row?: number; end_col?: number }|nil