0
Oktay Acikalin 7 years ago • updated 7 years ago 4
When having an existing file open and hitting command+n (OSX with build 2038) the events get fired in the wrong order:
1. on_new for the new buffer
2. on_deactivated for the old buffer
3. on_activated for the new buffer

I think that it should fire them in this order:
1. on_deactivated for the old buffer
2. on_new for the new buffer
3. on_activated for the new buffer

As far as I can guess, the on_new event is being triggered from a routine which then modifies the buffers and tabs. So my question is: Can/will you change/fix this order (soon)?
I think the current order is correct, insofar as it mirrors what's happening in the code: a new buffer gets created, and then added, which deactivates the old view, and activates the new one.

If there was a way to open a file in the background (i.e., open in a new tab, but don't activate), then it'd make sense to have the current ordering: a file is first created, and then activated at some point in the future.
Hmm... ok. Would you mind taking a look at my code and if this could be done in a better way?
https://bitbucket.org/theblacklion/sublime_plugins/src/tip/new_file_syntax.py
Thanks. Let's consider this as completed.