Shortcuts to move the active tab in the tab bar

This commit is contained in:
Kovid Goyal
2016-12-08 13:02:58 +05:30
parent 12751a505c
commit fc046d915d
4 changed files with 21 additions and 0 deletions

View File

@@ -253,6 +253,14 @@ class TabManager:
def tab_bar_height(self):
return 0 if len(self.tabs) < 2 else cell_size.height
def move_tab(self, delta=1):
if len(self.tabs) > 1:
idx = self.active_tab_idx
nidx = (idx + len(self.tabs) + delta) % len(self.tabs)
self.tabs[idx], self.tabs[nidx] = self.tabs[nidx], self.tabs[idx]
self.active_tab_idx = nidx
glfw_post_empty_event()
def title_changed(self, new_title):
with self.tabbar_lock:
self.tabbar_dirty = True