Fix new_tab_with_cwd not adding to active session
Fixes #9614 Fixes #9615
This commit is contained in:
parent
68ef054676
commit
6b2a8b6a65
2 changed files with 17 additions and 6 deletions
|
|
@ -665,11 +665,15 @@ def _new_os_window(self, args: SpecialWindowInstance | Iterable[str], cwd_from:
|
|||
startup_session = next(create_sessions(get_options(), special_window=sw, cwd_from=cwd_from))
|
||||
startup_session.session_name = ''
|
||||
ans = self.add_os_window(startup_session)
|
||||
if cwd_from is not None and (sow := cwd_from.window) and (tm := self.os_window_map.get(ans)) and sow.created_in_session_name:
|
||||
for tab in tm:
|
||||
tab.created_in_session_name = sow.created_in_session_name
|
||||
for w in tab:
|
||||
w.created_in_session_name = sow.created_in_session_name
|
||||
if cwd_from is not None and (sow := cwd_from.window) and (tm := self.os_window_map.get(ans)):
|
||||
session_name = sow.created_in_session_name
|
||||
if not session_name and (sow_tab := sow.tabref()):
|
||||
session_name = sow_tab.created_in_session_name
|
||||
if session_name:
|
||||
for tab in tm:
|
||||
tab.created_in_session_name = session_name
|
||||
for w in tab:
|
||||
w.created_in_session_name = session_name
|
||||
return ans
|
||||
|
||||
@ac('win', 'New OS Window')
|
||||
|
|
@ -2942,7 +2946,10 @@ def _new_window(self, args: list[str], cwd_from: CwdRequest | None = None) -> Wi
|
|||
else:
|
||||
w = tab.new_window(cwd_from=cwd_from, location=location, allow_remote_control=allow_remote_control)
|
||||
if cwd_from is not None and (sw := cwd_from.window):
|
||||
w.created_in_session_name = sw.created_in_session_name
|
||||
session_name = sw.created_in_session_name
|
||||
if not session_name and (sw_tab := sw.tabref()):
|
||||
session_name = sw_tab.created_in_session_name
|
||||
w.created_in_session_name = session_name
|
||||
return w
|
||||
|
||||
@ac('win', 'Create a new window')
|
||||
|
|
|
|||
|
|
@ -280,6 +280,8 @@ def _startup(self, session_tab: SessionTab) -> None:
|
|||
launched_window: Window | None = None
|
||||
if isinstance(spec, SpecialWindowInstance):
|
||||
launched_window = self.new_special_window(spec)
|
||||
if launched_window is not None:
|
||||
launched_window.created_in_session_name = self.created_in_session_name
|
||||
else:
|
||||
from .launch import launch
|
||||
spec.opts.add_to_session = self.created_in_session_name
|
||||
|
|
@ -1463,6 +1465,8 @@ def new_tab(
|
|||
session_name = ''
|
||||
if cwd_from is not None and (sw := cwd_from.window):
|
||||
session_name = sw.created_in_session_name
|
||||
if not session_name and (sw_tab := sw.tabref()):
|
||||
session_name = sw_tab.created_in_session_name
|
||||
t = Tab(self, no_initial_window=True, session_name=session_name) if empty_tab else Tab(
|
||||
self, special_window=special_window, cwd_from=cwd_from, session_name=session_name)
|
||||
if not empty_tab and session_name:
|
||||
|
|
|
|||
Loading…
Reference in a new issue