summaryrefslogtreecommitdiffstats
path: root/pairs.lua
diff options
context:
space:
mode:
authorGeorgi Kirilov <>2020-11-22 15:10:50 +0200
committerGeorgi Kirilov <>2023-10-04 18:24:59 +0800
commit80980dd364b2e845dd474558cd3a820e7e32cec7 (patch)
tree75f806b5be091b0b2c7ab34000063ec16cd7c7a4 /pairs.lua
parentadfb9800b111680a5b023ccda90d7f2b18e85244 (diff)
downloadvis-pairs-80980dd364b2e845dd474558cd3a820e7e32cec7.tar.gz
Fix off-by-one excessive newline barfage
Diffstat (limited to 'pairs.lua')
-rw-r--r--pairs.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/pairs.lua b/pairs.lua
index 8220f66..fbcb358 100644
--- a/pairs.lua
+++ b/pairs.lua
@@ -180,8 +180,8 @@ 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)
- if #newlines > 1 then
- return start + newlines[1] + 1, start + newlines[#newlines]
+ if #newlines > 0 then
+ return start + newlines[1], start + newlines[#newlines]
end
end
return start, finish