未验证 提交 ca40ac37 编写于 作者: A Alex Dima

Fixes #84998: Overtype after a backslash if the character is not a quote

上级 a6b869d4
......@@ -459,9 +459,10 @@ export class TypeOperations {
return false;
}
// Do not over-type after a backslash
// Do not over-type quotes after a backslash
const chIsQuote = isQuote(ch);
const beforeCharacter = position.column > 2 ? lineText.charCodeAt(position.column - 2) : CharCode.Null;
if (beforeCharacter === CharCode.Backslash) {
if (beforeCharacter === CharCode.Backslash && chIsQuote) {
return false;
}
......
......@@ -4936,6 +4936,35 @@ suite('autoClosingPairs', () => {
mode.dispose();
});
test('issue #84998: Overtyping Brackets doesn\'t work after backslash', () => {
let mode = new AutoClosingMode();
usingCursor({
text: [
''
],
languageIdentifier: mode.getLanguageIdentifier()
}, (model, cursor) => {
cursor.setSelections('test', [new Selection(1, 1, 1, 1)]);
cursorCommand(cursor, H.Type, { text: '\\' }, 'keyboard');
assert.equal(model.getValue(), '\\');
cursorCommand(cursor, H.Type, { text: '(' }, 'keyboard');
assert.equal(model.getValue(), '\\()');
cursorCommand(cursor, H.Type, { text: 'abc' }, 'keyboard');
assert.equal(model.getValue(), '\\(abc)');
cursorCommand(cursor, H.Type, { text: '\\' }, 'keyboard');
assert.equal(model.getValue(), '\\(abc\\)');
cursorCommand(cursor, H.Type, { text: ')' }, 'keyboard');
assert.equal(model.getValue(), '\\(abc\\)');
});
mode.dispose();
});
test('issue #2773: Accents (´`¨^, others?) are inserted in the wrong position (Mac)', () => {
let mode = new AutoClosingMode();
usingCursor({
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册