Fix using the `new_tab !neighbor` action changing the order of the non-neighboring tabs

Fixes #1256
This commit is contained in:
Kovid Goyal 2018-12-23 08:45:34 +05:30
parent 494035c94b
commit 4e7498b854
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 6 additions and 2 deletions

View File

@ -28,6 +28,9 @@ Changelog
- Add an action to resize windows that can be mapped to shortcuts in :file:`kitty.conf`
(:pull:`1245`)
- Fix using the ``new_tab !neighbor`` action changing the order of the
non-neighboring tabs (:iss:`1256`)
0.13.1 [2018-12-06]
------------------------------

View File

@ -522,8 +522,9 @@ class TabManager: # {{{
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)
for i in range(idx, nidx, -1):
self.tabs[i], self.tabs[i-1] = self.tabs[i-1], self.tabs[i]
swap_tabs(self.os_window_id, i, i-1)
self._set_active_tab(nidx)
idx = nidx
self.mark_tab_bar_dirty()