Skip to content

Commit e053652

Browse files
Merge branch 'MulticursorAutoclose' into dev
2 parents daddf22 + 5e5891b commit e053652

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

runtime/plugins/autoclose/autoclose.lua

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,21 @@ function preInsertNewlineAct(bp)
2424
bp:CursorLeft()
2525
bp:InsertNewline()
2626
bp:InsertTab()
27-
return true
27+
return
2828
end
2929
end
3030
end
31-
return false
31+
32+
bp:InsertNewline()
33+
return
3234
end
3335

3436
function preBackspaceAct(bp)
3537
for i = 1, #autoclosePairs do
3638
local curLine = bp.Buf:Line(bp.Cursor.Y)
3739
if charAt(curLine, bp.Cursor.X+1) == charAt(autoclosePairs[i], 2) and charAt(curLine, bp.Cursor.X) == charAt(autoclosePairs[i], 1) then
3840
bp:Delete()
41+
return
3942
end
4043
end
4144
end
@@ -75,20 +78,22 @@ function preInsertNewline(bp)
7578
local inserted = false
7679
for i = 1,#bp.Buf:getCursors() do
7780
bp.Cursor = bp.Buf:GetCursor(i-1)
78-
if preInsertNewlineAct(bp) then
79-
inserted = true
80-
end
81+
preInsertNewlineAct(bp)
8182
end
8283
bp.Cursor = bp.Buf:GetCursor(activeCursorNum)
83-
return not inserted
84+
85+
return false
8486
end
8587

8688
function preBackspace(bp)
8789
local activeCursorNum = bp.Buf:GetActiveCursor().Num
90+
local inserted = false
8891
for i = 1,#bp.Buf:getCursors() do
8992
bp.Cursor = bp.Buf:GetCursor(i-1)
9093
preBackspaceAct(bp)
94+
bp:Backspace()
9195
end
9296
bp.Cursor = bp.Buf:GetCursor(activeCursorNum)
93-
return true
97+
98+
return false
9499
end

0 commit comments

Comments
 (0)