Skip to content

Commit

Permalink
Fix anchoring of leading whitespace check
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickpeterse committed May 7, 2024
1 parent e81d468 commit e7f7b6c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lua/tree-pairs/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ local function match(buf, fallback)
local pos = api.nvim_win_get_cursor(0)
local cursor_row = pos[1] - 1
local cursor_col = pos[2]

local line = api.nvim_get_current_line()

if #line > 0 then
Expand All @@ -112,7 +111,7 @@ local function match(buf, fallback)
do
cursor_col = cursor_col - 1
end
elseif line:sub(1, cursor_col + 1):match('^%s') then
elseif line:sub(1, cursor_col + 1):match('^%s$') then
-- If the cursor is instead in between leading whitespace and the first
-- non-whitespace character, we treat that first non-whitespace character
-- as the start, matching the behaviour of matchit.
Expand Down

0 comments on commit e7f7b6c

Please sign in to comment.