Skip to content

Commit 18a632d

Browse files
committed
Make findMatchingBracket swap between start and end brackets.
matchBracket returns an array containing start and end ranges for brackets. Previously, findMatchingBracket (corresponding to vim's % motion) would always jump to the end bracket. Fix it to jump to the bracket whose range does not contain the current cursor position.
1 parent b1c31bf commit 18a632d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/cm_adapter.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,11 @@ class CMAdapter {
969969
}
970970

971971
return {
972-
to: toCmPos(res[1].getStartPosition()),
972+
to: toCmPos(
973+
res[0].containsPosition(mPos)
974+
? res[1].getStartPosition()
975+
: res[0].getStartPosition()
976+
),
973977
};
974978
}
975979

0 commit comments

Comments
 (0)