do not check sub-modes in get_tags_at
All checks were successful
NeoVim tests / code-quality (push) Successful in 1m20s
All checks were successful
NeoVim tests / code-quality (push) Successful in 1m20s
cull test-dependency
This commit is contained in:
parent
6785398c96
commit
f1e225cba9
2
.busted
2
.busted
@ -2,7 +2,7 @@ return {
|
|||||||
_all = {
|
_all = {
|
||||||
coverage = false,
|
coverage = false,
|
||||||
lpath = "lua/?.lua;lua/?/init.lua",
|
lpath = "lua/?.lua;lua/?/init.lua",
|
||||||
lua = "nlua",
|
lua = "nvim -u NONE -i NONE -l",
|
||||||
},
|
},
|
||||||
default = {
|
default = {
|
||||||
verbose = true
|
verbose = true
|
||||||
|
@ -340,7 +340,9 @@ function Renderer:_expr_map_callback(mode, lhs) -- {{{
|
|||||||
-- find the tag with the smallest intersection that contains the cursor:
|
-- find the tag with the smallest intersection that contains the cursor:
|
||||||
local pos0 = vim.api.nvim_win_get_cursor(0)
|
local pos0 = vim.api.nvim_win_get_cursor(0)
|
||||||
pos0[1] = pos0[1] - 1 -- make it actually 0-based
|
pos0[1] = pos0[1] - 1 -- make it actually 0-based
|
||||||
|
log('_expr_map_callback: pos0:', pos0)
|
||||||
local pos_infos = self:get_tags_at(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
|
if #pos_infos == 0 then return lhs end
|
||||||
|
|
||||||
@ -538,21 +540,26 @@ end -- }}}
|
|||||||
function Renderer:get_tags_at(pos0, mode) -- {{{
|
function Renderer:get_tags_at(pos0, mode) -- {{{
|
||||||
local cursor_line0, cursor_col0 = pos0[1], pos0[2]
|
local cursor_line0, cursor_col0 = pos0[1], pos0[2]
|
||||||
if not mode then mode = vim.api.nvim_get_mode().mode end
|
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
|
-- 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,
|
-- 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:
|
-- because the NeoVim API is over-inclusive in what it returns:
|
||||||
--- @type u.renderer.RendererExtmark[]
|
--- @type u.renderer.RendererExtmark[]
|
||||||
local mapped_extmarks = vim
|
local mapped_extmarks = vim
|
||||||
.iter(
|
.iter(raw_overlapping_extmarks)
|
||||||
vim.api.nvim_buf_get_extmarks(
|
|
||||||
self.bufnr,
|
|
||||||
self.ns,
|
|
||||||
pos0,
|
|
||||||
pos0,
|
|
||||||
{ details = true, overlap = true }
|
|
||||||
)
|
|
||||||
)
|
|
||||||
--- @return u.renderer.RendererExtmark
|
--- @return u.renderer.RendererExtmark
|
||||||
:map(function(ext)
|
:map(function(ext)
|
||||||
--- @type number, number, number, { end_row?: number; end_col?: number }|nil
|
--- @type number, number, number, { end_row?: number; end_col?: number }|nil
|
||||||
|
@ -16,7 +16,6 @@ pkgs.mkShell {
|
|||||||
pkgs.lua51Packages.busted
|
pkgs.lua51Packages.busted
|
||||||
pkgs.lua51Packages.luacov
|
pkgs.lua51Packages.luacov
|
||||||
pkgs.lua51Packages.luarocks
|
pkgs.lua51Packages.luarocks
|
||||||
pkgs.lua51Packages.nlua
|
|
||||||
pkgs.neovim
|
pkgs.neovim
|
||||||
pkgs.stylua
|
pkgs.stylua
|
||||||
pkgs.watchexec
|
pkgs.watchexec
|
||||||
|
Loading…
x
Reference in New Issue
Block a user