[quote=“jps”]
Jump Back / Jump Forward were done by Hong, one of Sublime HQs new employees (the other being Kari, whose work you can see in the recent blog post). You can direct all blame there, provided I can cajole him into joining the forum [/quote]
So thanks Hong, clever implementation and nicely writing (even unittest!).
I think there’s only a small bug (typo) here:
elif name == 'move_to' and args'to'] == 'bof' and args'to'] == 'eof':
# move to bof/eof
get_jump_history(view.window().id()).push_selection(view)
I suppose it must be a or in the test:
elif name == 'move_to' and (args'to'] == 'bof' or args'to'] == 'eof'):
When I saw the addition of on_text_command/on_window_command, I immediately though it will be useful for this kind of things but I’m not sure that, if I had to write it myself, my solution will be as clean.
Using add_region() in on_selection_modified/on_modified event is a nightmare, undo command screw everything.
Now I’ve a question for Hong:
Currently the commands that trigger a push_selection() is written in stone (does it means something in english ?) in the on_text_command.
I have my own commands to navigate in the view and I like that they trigger the push_selection() too.
Is it OK to create my own eventlistener and use push_selection() ?
[code]import sublime, sublime_plugin
import Default.history_list as history_list
class MyJumpHistoryUpdater(sublime_plugin.EventListener):
def on_text_command(self, view, name, args):
if view.settings().get(‘is_widget’):
return
if name == ‘move’ and args’by’] == ‘words’:
# syntax is {‘by’: ‘lines’, ‘forward’: True}
history_list.get_jump_history(view.window().id()).push_selection(view)[/code]