Don't crash when trying to apply lastSelectionEvent
selection that is out-of-range (#5644)
* Dumbest possible fix: don't let the `throw` propogate * Add E2E test * Fix lint
This commit is contained in:
@ -96,11 +96,15 @@ export const KclEditorPane = () => {
|
||||
return
|
||||
}
|
||||
|
||||
editorManager.editorView.dispatch({
|
||||
selection: lastSelectionEvent.codeMirrorSelection,
|
||||
annotations: [modelingMachineEvent, Transaction.addToHistory.of(false)],
|
||||
scrollIntoView: lastSelectionEvent.scrollIntoView,
|
||||
})
|
||||
try {
|
||||
editorManager.editorView.dispatch({
|
||||
selection: lastSelectionEvent.codeMirrorSelection,
|
||||
annotations: [modelingMachineEvent, Transaction.addToHistory.of(false)],
|
||||
scrollIntoView: lastSelectionEvent.scrollIntoView,
|
||||
})
|
||||
} catch (e) {
|
||||
console.error('Error setting selection', e)
|
||||
}
|
||||
}, [editorIsMounted, lastSelectionEvent])
|
||||
|
||||
const textWrapping = context.textEditor.textWrapping
|
||||
|
Reference in New Issue
Block a user