summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pairs.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/pairs.lua b/pairs.lua
index 537e481..581b7ae 100644
--- a/pairs.lua
+++ b/pairs.lua
@@ -248,7 +248,7 @@ local function bail_early()
return false
end
-local function handler(func)
+local function prep(func)
return function(win, pos)
if bail_early() then return pos end
local content = win.file:content(0, win.file.size)
@@ -257,7 +257,7 @@ local function handler(func)
end
local function new(execute, register, prefix, handler, help)
- local id = register(vis, handler)
+ local id = register(vis, prep(handler))
if id < 0 then
return false
end
@@ -289,12 +289,12 @@ end
vis.events.subscribe(vis.events.INIT, function()
M.motion = {
- opening = new(vis.motion, vis.motion_register, M.prefix.opening, handler(opening), "Move cursor to the beginning of a delimited block"),
- closing = new(vis.motion, vis.motion_register, M.prefix.closing, handler(closing), "Move cursor to the end of a delimited block"),
+ opening = new(vis.motion, vis.motion_register, M.prefix.opening, opening, "Move cursor to the beginning of a delimited block"),
+ closing = new(vis.motion, vis.motion_register, M.prefix.closing, closing, "Move cursor to the end of a delimited block"),
}
M.textobject = {
- inner = new(vis.textobject, vis.textobject_register, M.prefix.inner, handler(inner), "Delimited block (inner variant)"),
- outer = new(vis.textobject, vis.textobject_register, M.prefix.outer, handler(outer), "Delimited block (outer variant)"),
+ inner = new(vis.textobject, vis.textobject_register, M.prefix.inner, inner, "Delimited block (inner variant)"),
+ outer = new(vis.textobject, vis.textobject_register, M.prefix.outer, outer, "Delimited block (outer variant)"),
}
local function cmp(_, _, c1, c2) return c1 == c2 end