Fixes #23711
This commit is contained in:
parent
4ee2f42db0
commit
edc667ecb7
2 changed files with 18 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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', () => {
|
||||
|
|
Loading…
Reference in a new issue