Open h3xOo opened 2 weeks ago
I think this can be the quickfix
diff --git a/lua/leap/highlight.lua b/lua/leap/highlight.lua
index 753d403..09040bf 100644
--- a/lua/leap/highlight.lua
+++ b/lua/leap/highlight.lua
@@ -58,8 +58,10 @@ M["apply-backdrop"] = function(self, backward_3f, _3ftarget_windows)
local function _11_()
if backward_3f then
return {{win_top, 0}, {curline, curcol}}
- else
+ elseif curline ~= win_bot then
return {{curline, inc(curcol)}, {win_bot, -1}}
+ else
+ return {{curline, inc(curcol)}, {win_bot, vim.fn.col("$")}}
end
end
local _let_12_ = _11_()
With debug prints, on last line we were highlight from f.e. from { 1, 1 }
to { 1, -1 }
and nvim doesn't handle that?
I used this debug print
print(string.format("start = (%d, %d), finish = (%d, %d)", start[1], start[2], finish[1], finish[2]))
before vim.highlight.range()
call
@ggandor pinging for comments/thoughts
As it turns out, vim.highlight.range()
calls vim.region()
, which will swap start and finish (if I'm correct)
This also works
diff --git a/lua/leap/highlight.lua b/lua/leap/highlight.lua
index 753d403..403bb7c 100644
--- a/lua/leap/highlight.lua
+++ b/lua/leap/highlight.lua
@@ -59,7 +59,7 @@ M["apply-backdrop"] = function(self, backward_3f, _3ftarget_windows)
if backward_3f then
return {{win_top, 0}, {curline, curcol}}
else
- return {{curline, inc(curcol)}, {win_bot, -1}}
+ return {{curline, inc(curcol)}, {win_bot + 1, -1}}
end
end
local _let_12_ = _11_()
But highlighting after last line feels a bit hacky
Hi, thanks for the report! I can reproduce on 0.10.1 stable, but the problem seems to be fixed on 0.11.
Oh, I'm on 0.10.1.
Out of curiosity I checked that they added explicit check for -1
in vim.highlight.range()
.
As in title, if I press "s" for forward leap while cursor is on last line in the file, no highlighting is applied (neither text becomes grey via link to Comment nor possible targets are purple/pink).
Same goes for f/t from flit (but S/F/T work in first and last line in buffer).