mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-26 02:02:14 +02:00
When mapping the new_tab action allow specifying that the tab should open next to the current tab instead of at the end of the tabs list
Fixes #979
This commit is contained in:
@@ -464,10 +464,16 @@ class TabManager: # {{{
|
||||
self._set_active_tab(nidx)
|
||||
self.mark_tab_bar_dirty()
|
||||
|
||||
def new_tab(self, special_window=None, cwd_from=None):
|
||||
def new_tab(self, special_window=None, cwd_from=None, as_neighbor=False):
|
||||
nidx = self.active_tab_idx + 1
|
||||
idx = len(self.tabs)
|
||||
self._add_tab(Tab(self, special_window=special_window, cwd_from=cwd_from))
|
||||
self._set_active_tab(idx)
|
||||
if len(self.tabs) > 2 and as_neighbor and idx != nidx:
|
||||
self.tabs[idx], self.tabs[nidx] = self.tabs[nidx], self.tabs[idx]
|
||||
swap_tabs(self.os_window_id, idx, nidx)
|
||||
self._set_active_tab(nidx)
|
||||
idx = nidx
|
||||
self.mark_tab_bar_dirty()
|
||||
return self.tabs[idx]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user