Add a new mappable action `close_other_windows_in_tab` to close all but the active window
Fixes #2484
This commit is contained in:
parent
8f1c6c4d74
commit
93a281c7e3
@ -10,6 +10,9 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
||||
- Fix a regression in 0.17 that broke drawing of borders with non-minimal
|
||||
borders (:iss:`2474`)
|
||||
|
||||
- Add a new mappable action ``close_other_windows_in_tab`` to close all but the
|
||||
active window (:iss:`2484`)
|
||||
|
||||
- Hints kitten: Adjust the default regex used to detect line numbers to handle
|
||||
line+column numbers (:iss:`2268`)
|
||||
|
||||
|
||||
@ -192,6 +192,12 @@ Similarly, you can detach the current tab, with::
|
||||
# asks which OS Window to move the tab into
|
||||
map ctrl+f4 detach_tab ask
|
||||
|
||||
Finally, you can define a shortcut to close all windows in a tab other than
|
||||
the currently active window::
|
||||
|
||||
map f9 close_other_windows_in_tab
|
||||
|
||||
|
||||
Other keyboard shortcuts
|
||||
----------------------------------
|
||||
|
||||
|
||||
@ -384,6 +384,13 @@ class Tab: # {{{
|
||||
if self.windows:
|
||||
self.remove_window(self.windows[self.active_window_idx])
|
||||
|
||||
def close_other_windows_in_tab(self) -> None:
|
||||
if len(self.windows) > 1:
|
||||
active_window = self.windows[self.active_window_idx]
|
||||
for window in tuple(self.windows):
|
||||
if window is not active_window:
|
||||
self.remove_window(window)
|
||||
|
||||
def previous_active_window_idx(self, num: int) -> Optional[int]:
|
||||
try:
|
||||
old_window_id = self.active_window_history[-num]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user