I'm trying to find a way to test if the cursor is preceded by a specific string and then trigger an event.
Example of what I'm trying to do:
User clicks somewhere inside the editor, a cursorActivity
(cursor or editor changed) event is fired, I catch the event and test whether or not the previous 6 characters matches the string 'color:'
If so then do I something.
I can't seem to find any kind of method that lets you actually read directly from the editor though, aside from catching the readInput
event which is triggered every time a character is typed or a string is pasted. This works to a point but fails when a user moves the cursor with a mouse click.
TL;DR How can I detect when the cursor has moved somewhere immediately after a specific string?