Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions kitty/boss.py
Original file line number Diff line number Diff line change
Expand Up @@ -2675,8 +2675,9 @@ def _move_window_to(
tm = q
else:
tm = self.os_window_map[target_os_window_id]
if target_tab_id == 'new':
target_tab = tm.new_tab(empty_tab=True)
if target_tab_id.startswith('new'):
# valid values for target_tab_id are 'new', 'new_after' and 'new_before'
target_tab = tm.new_tab(empty_tab=True, location=(target_tab_id[4:] or 'last'))
else:
target_tab = tm.tab_at_location(target_tab_id) or tm.new_tab(empty_tab=True)
else:
Expand Down Expand Up @@ -2767,8 +2768,15 @@ def format_tab_title(tab: Tab) -> str:
def detach_window(self, *args: str) -> None:
if not args or args[0] == 'new':
return self._move_window_to(target_os_window_id='new')
if args[0] in ('new-tab', 'tab-prev', 'tab-left', 'tab-right'):
where = 'new' if args[0] == 'new-tab' else args[0][4:]
if args[0] in ('new-tab', 'tab-prev', 'tab-left', 'tab-right', 'new-tab-left', 'new-tab-right'):
if args[0] == 'new-tab':
where = 'new'
elif args[0] == 'new-tab-right':
where = 'new_after'
elif args[0] == 'new-tab-left':
where = 'new_before'
else:
where = args[0][4:]
return self._move_window_to(target_tab_id=where)
ct = self.active_tab
items: List[Tuple[Union[str, int], str]] = [(t.id, t.effective_title) for t in self.all_tabs if t is not ct]
Expand Down
2 changes: 1 addition & 1 deletion kitty/options/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def goto_tab_parse(func: str, rest: str) -> FuncArgsType:

@func_with_args('detach_window')
def detach_window_parse(func: str, rest: str) -> FuncArgsType:
if rest not in ('new', 'new-tab', 'ask', 'tab-prev', 'tab-left', 'tab-right'):
if rest not in ('new', 'new-tab', 'new-tab-left', 'new-tab-right', 'ask', 'tab-prev', 'tab-left', 'tab-right'):
log_error(f'Ignoring invalid detach_window argument: {rest}')
rest = 'new'
return func, (rest,)
Expand Down