Hi,
I’ve already asked some questions about my “moving tabs to the right” plugin (and have received some wonderful answers, thanks for that.)
I was wondering if there is a way to set the view_index of a newly created view. I’m using on_new(self,view) (and have tried on_activated) to get a reference to the newly created view, but its view index at that point in time is always set to -1. Changing it with window.set_view_index(view, group, rightIndex) does nothing. It appears the view’s index is set by SublimeText after these events fire. There may be a good reason for this, but in my case it makes things difficult.
Is there a way to change the index of a newly created view? If there isn’t, is there a polite way to ask Jon to add this to the API?
I’ll include some samplecode from my plugin so you can understand what I mean.
class TabrightEvent(sublime_plugin.EventListener):
def move_tab_right(self,view):
if not view.settings().get("Tabright_processed"):
window = sublime.active_window()
view.settings().set("Tabright_processed", True)
group,index = window.get_view_index(view)
rightIndex = len(window.views_in_group(group)) - 1
window.set_view_index(view, group, rightIndex)
window.focus_group(group)
window.focus_view(view)
def on_new(self,view):
self.move_tab_right(view)
Thanks in advance!