I'm working on an Etherpad-lite plugin providing special autocomplete while writing. I'm trying to update the list of autocomplete items as the user writes. My problem is that the caret position in aceEditEvent's context.rep.selStart and context.rep.selEnd is only updated in the first idleWorkTimer event after the keypress, which has a huge latency for this purpose.
The events in aceEditEvent happen like the following:
So how do I get the new caret position without latency?
The answer is here: https://github.com/ether/etherpad-lite/issues/2015
Basically this problem is still unsolved. As a workaround it's possible to use setTimeout after the event to have the right caret position.