This commit is contained in:
Alex Dima 2017-04-28 00:57:38 +02:00
parent 4ee2f42db0
commit edc667ecb7
2 changed files with 18 additions and 1 deletions

View file

@ -464,7 +464,7 @@ export class TypeOperations {
}
private static _typeInterceptorElectricChar(config: CursorConfiguration, model: ITokenizedModel, cursor: SingleCursorState, ch: string): EditOperationResult {
if (!config.electricChars.hasOwnProperty(ch)) {
if (!config.electricChars.hasOwnProperty(ch) || !cursor.selection.isEmpty()) {
return null;
}

View file

@ -2965,6 +2965,23 @@ suite('ElectricCharacter', () => {
});
mode.dispose();
});
test('issue #23711: Replacing selected text with )]} fails to delete old text with backwards-dragged selection', () => {
let mode = new ElectricCharMode();
usingCursor({
text: [
'{',
'word'
],
languageIdentifier: mode.getLanguageIdentifier()
}, (model, cursor) => {
moveTo(cursor, 2, 5);
moveTo(cursor, 2, 1, true);
cursorCommand(cursor, H.Type, { text: '}' }, 'keyboard');
assert.deepEqual(model.getLineContent(2), '}');
});
mode.dispose();
});
});
suite('autoClosingPairs', () => {