summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorgi Kirilov <>2020-11-22 15:10:50 +0200
committerGeorgi Kirilov <>2023-10-04 18:24:59 +0800
commit33f905a2343ad6e986be20c65ac4fbce7b9bee8e (patch)
tree853110c7ac7c2bb5ff0b2108869c8fd1f0fe8049
parent80980dd364b2e845dd474558cd3a820e7e32cec7 (diff)
downloadvis-pairs-33f905a2343ad6e986be20c65ac4fbce7b9bee8e.tar.gz
Avoid an unnecessary string copy
-rw-r--r--pairs.lua5
1 files changed, 2 insertions, 3 deletions
diff --git a/pairs.lua b/pairs.lua
index fbcb358..87bda51 100644
--- a/pairs.lua
+++ b/pairs.lua
@@ -178,10 +178,9 @@ end
local function barf_linewise(content, start, finish)
if vis.mode == vis.modes.VISUAL_LINE then
- local block = content:sub(start + 1, finish)
- local newlines = l.match(l.Ct((l.Cp() * l.P"\n" + 1)^0), block)
+ local newlines = l.match(l.Ct((l.Cp() * l.P"\n" + 1 * l.Cmt(l.Cc(finish), not_past))^0), content, start + 1)
if #newlines > 0 then
- return start + newlines[1], start + newlines[#newlines]
+ return newlines[1], newlines[#newlines]
end
end
return start, finish