I write a package that must parse every input. Based on the input, an internal data structure is modified and the parsed to a text which then replaces the editors text. This is done on every input!
For example: pressing backspace must not lead to a deletion of text. In some cases this is not allowed.
Is there any possibility to suppress the input, so my package can parse the it and update the text without getting the visible text updated twice?
TextEditor#onWillInsertText with a cancel property, but it does not work for e.g. backspace. Furthermore I have no access to the selected range(s).
TextBuffer#onWillChange seems the right interface, but I cannot cancel the input.
Or do you have any other ideas on how to handle that problem?