From 80980dd364b2e845dd474558cd3a820e7e32cec7 Mon Sep 17 00:00:00 2001 From: Georgi Kirilov <> Date: Sun, 22 Nov 2020 15:10:50 +0200 Subject: Fix off-by-one excessive newline barfage --- pairs.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'pairs.lua') 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 -- cgit