From 4e7498b8540511451d5e0fc34fb7b8942477a8be Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 23 Dec 2018 08:45:34 +0530 Subject: [PATCH] Fix using the ``new_tab !neighbor`` action changing the order of the non-neighboring tabs Fixes #1256 --- docs/changelog.rst | 3 +++ kitty/tabs.py | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 1e8f544c3..60bbf531a 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -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] ------------------------------ diff --git a/kitty/tabs.py b/kitty/tabs.py index 46b871085..e04dba2f9 100644 --- a/kitty/tabs.py +++ b/kitty/tabs.py @@ -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()