Skip to content

Commit

Permalink
fix(start-pair): if last end pair char exist then skip insert
Browse files Browse the repository at this point in the history
  • Loading branch information
altermo committed Jan 10, 2024
1 parent 8e1fcc8 commit 7e28167
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lua/ultimate-autopair/profile/default/pairas.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ M.fn={
function M.check_wrapp(m)
return function(o)
if not m.fn.can_check(o) then return end
local part_end_present=o.line:sub(o.col,o.col+#m.end_pair-2)==m.end_pair:sub(2)
local part_end_present=o.line:sub(o.col,o.col+#m.end_pair-2)==m.end_pair:sub(-1)
return utils.create_act({
m.start_pair:sub(-1),
(part_end_present and m.end_pair:sub(1,1) or m.end_pair),
{'h',#m.end_pair-(part_end_present and #m.end_pair-1 or 0)},
(part_end_present and m.end_pair:sub(1,-2) or m.end_pair),
{'h',#m.end_pair-(part_end_present and 1 or 0)},
})
end
end
Expand Down
6 changes: 3 additions & 3 deletions lua/ultimate-autopair/profile/default/pairs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ M.fn={
function M.check_wrapp(m)
return function(o)
if not m.fn.can_check(o) then return end
local part_end_present=o.line:sub(o.col,o.col+#m.end_pair-2)==m.end_pair:sub(2)
local part_end_present=o.line:sub(o.col,o.col+#m.end_pair-2)==m.end_pair:sub(-1)
return utils.create_act({
m.start_pair:sub(-1),
(part_end_present and m.end_pair:sub(1,1) or m.end_pair),
{'h',#m.end_pair-(part_end_present and #m.end_pair-1 or 0)},
(part_end_present and m.end_pair:sub(1,-2) or m.end_pair),
{'h',#m.end_pair-(part_end_present and 1 or 0)},
})
end
end
Expand Down

0 comments on commit 7e28167

Please sign in to comment.