Hello ST family,
I am absolutely new here, I would like to ask some question about plugin development regarding the undo feature:
- Is it possible to call âundoâ command in a TextCommand (or other Commands) to undo previous command (such as paste). I tried this but it just wouldnât work:
import sublime, sublime_plugin
class MyUndoCommand(sublime_plugin.TextCommand):
def run(self, edit):
print 'I would like to undo last action (by other plugin, such as previous paste'
self.view.run_command('undo')
- Is it possible to retrieve the command has been undo? It looks like that command_history just shift it out from the stack. Doing a search I found https://forum.sublimetext.com/t/detect-its-whether-a-undo-or-a-redo-command-in-on-modified/6235/1&hilit=undo#p33227 which mention
glue_marked_undo_groups,unmark_undo_groups_for_gluing, maybe_mark_undo_groups_for_gluing
but I canât find document about them.
Thank you and happy STing.