Open fpaboim opened 11 years ago
Yep, this is absolutely a side effect of the hack I needed to use to get EasyMotion to work in ST2. The APIs around this kind of thing are really weak unfortunately (and getting even weaker in ST3). It would have been so much easier if there were some sort of overlay methods available.
There really isn't much that I can do about this with the current implementation. There's nothing available to me to remove something from the undo/redo stack.
A longer term refactor that I've started, but haven't touched in a little while, actually gets around this by copying the visible region, creating a new temp buffer and sticking the copied visible region into it, and then decorating that. Once a selection is made, it destroys the temp buffer and returns the user to the original buffer and moves the cursor. The APIs around that are kind of wonky, so it feels like just another hack with what I have, but it could be a better solution (and one that'll work in ST3). I'll probably pick it back up once ST3 goes final. That solution would get around the redo issue that you point out (but could have other side effects :). We'll see.
Sounds promising and time consuming :). Haven't looked at the new ST3 API but I would have thought that one of the things that would really improve the ecosystem was extending their API to allow contributors more freedom modifying the general look and feel and being able to grab more internal info.. Allowing some simple overlay would be on top of my priority list considering a lot of my beef with ST2 is that I can't customize a lot of interface features that i've grown accustomed to from VIM and VS such as vimlines (don't know if you've used it but you have to modify the font you're using in a C source file to generate pngs which are then used as the line numbers.. which kinda works), whitespaces as barely visible dots (for which I haven't found a solution) and now this. I would be nice to have an interactive layer where you could just tell it to display stuff, maybe even with hotspots or something like that to enable custom menus. Would be possible to make nice non-stock autocomplete stuff too... even pong would be easy to implement as a plugin!
Using easymotion and cancelling the action will leave the substituited characters in the redo stack. Don't know if it's possible to make the cancel action undo the substitutions. A naive approach would be to watch for the esc key and undo but if the cancelling button is bound to another key that won't work, maybe it's watchable through callbacks? Not really a big issue, although if someone accidentaly does that, saves and closes the files it could be a real pain if the file isn't version controlled. BTW, great job, I was waiting for a plugin like this for ages! I though of creating a version myself but when I saw the API has no method of overlaying text (which would also really help for vim lines...) I gave up, nice hack!