diff options
author | Georgi Kirilov <> | 2020-11-22 15:10:50 +0200 |
---|---|---|
committer | Georgi Kirilov <> | 2023-10-04 18:24:59 +0800 |
commit | 33f905a2343ad6e986be20c65ac4fbce7b9bee8e (patch) | |
tree | 853110c7ac7c2bb5ff0b2108869c8fd1f0fe8049 | |
parent | 80980dd364b2e845dd474558cd3a820e7e32cec7 (diff) | |
download | vis-pairs-33f905a2343ad6e986be20c65ac4fbce7b9bee8e.tar.gz |
Avoid an unnecessary string copy
-rw-r--r-- | pairs.lua | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -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 |