M: Improve double boolean editing

This commit is contained in:
Ivan 2025-06-10 21:20:47 +03:00
parent 46f3099b01
commit a2f300cf84

View File

@ -145,6 +145,15 @@ export class RSTextWrapper extends CodeMirrorWrapper {
return true;
}
case TokenID.BOOLEAN: {
if (!hasSelection && selection.from >= 2) {
const enclosingText = this.ref.view.state.sliceDoc(selection.from - 2, selection.from + 1);
if (enclosingText === '()') {
this.ref.view.dispatch({
changes: [{ from: selection.from - 2, insert: '' }]
});
return true;
}
}
if (hasSelection && this.startsWithBoolean(selection)) {
this.envelopeWith('', '');
} else {