提交 95158828 编写于 作者: R rebornix

Fix #17645. Make endoffset correct when searching for matching pair.

上级 dbef8f1a
......@@ -391,9 +391,10 @@ export class TypeOperations {
}
if (electricAction.matchOpenBracket) {
let endColumn = (lineTokens.getLineContent() + ch).lastIndexOf(electricAction.matchOpenBracket) + 1;
let match = model.findMatchingBracketUp(electricAction.matchOpenBracket, {
lineNumber: position.lineNumber,
column: position.column
column: endColumn
});
if (match) {
......
......@@ -2957,6 +2957,23 @@ suite('ElectricCharacter', () => {
mode.dispose();
});
test('is no-op if pairs are all matched before', () => {
let mode = new ElectricCharMode();
usingCursor({
text: [
'foo(() => {',
' ( 1 + 2 ) ',
'})'
],
languageIdentifier: mode.getLanguageIdentifier()
}, (model, cursor) => {
moveTo(cursor, 2, 13);
cursorCommand(cursor, H.Type, { text: '*' }, 'keyboard');
assert.deepEqual(model.getLineContent(2), ' ( 1 + 2 ) *');
});
mode.dispose();
});
test('appends text', () => {
let mode = new ElectricCharMode();
usingCursor({
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册