From 50a6abaac152a4d4104b565861c95def1987d13f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 4 Jan 2019 06:59:38 +0530 Subject: [PATCH] Also fix move_tab to preserve existing tab order --- kitty/tabs.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kitty/tabs.py b/kitty/tabs.py index e04dba2f9..fef567638 100644 --- a/kitty/tabs.py +++ b/kitty/tabs.py @@ -511,8 +511,10 @@ class TabManager: # {{{ 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] - swap_tabs(self.os_window_id, idx, nidx) + step = 1 if idx < nidx else -1 + for i in range(idx, nidx, step): + self.tabs[i], self.tabs[i + step] = self.tabs[i + step], self.tabs[i] + swap_tabs(self.os_window_id, i, i + step) self._set_active_tab(nidx) self.mark_tab_bar_dirty()