-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No highlight with forward leap on last line in buffer #248
Comments
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 print(string.format("start = (%d, %d), finish = (%d, %d)", start[1], start[2], finish[1], finish[2])) before |
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 |
I just noticed, that the same thing happens with diff --git a/lua/leap/highlight.lua b/lua/leap/highlight.lua
index efca9a5..63dfe60 100644
--- a/lua/leap/highlight.lua
+++ b/lua/leap/highlight.lua
@@ -55,7 +55,8 @@ M["apply-backdrop"] = function(self, backward_3f, _3ftarget_windows)
if _3ftarget_windows then
for _, winid in ipairs(_3ftarget_windows) do
local wininfo = vim.fn.getwininfo(winid)[1]
- vim.highlight.range(wininfo.bufnr, self.ns, self.group.backdrop, {dec(wininfo.topline), 0}, {dec(wininfo.botline), -1}, {priority = self.priority.backdrop})
+ local lastcol = wininfo.botline == 1 and vim.fn.col "$" or -1
+ vim.highlight.range(wininfo.bufnr, self.ns, self.group.backdrop, {dec(wininfo.topline), 0}, {dec(wininfo.botline), lastcol}, {priority = self.priority.backdrop})
end
return nil
else
@@ -69,7 +70,8 @@ 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}}
+ local lastcol = curline == win_bot and vim.fn.col "$" or -1
+ return {{curline, inc(curcol)}, {win_bot, lastcol}}
end
end
local _let_13_ = _12_() |
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).
The text was updated successfully, but these errors were encountered: