Fix the `*_with_cwd` actions using the cwd of the overlay window rather than the underlying window's cwd

Fix #1045
This commit is contained in:
Kovid Goyal 2018-10-03 19:26:01 +05:30
parent 2637018b53
commit 715f7985c7
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 13 additions and 3 deletions

View File

@ -10,6 +10,9 @@ Changelog
extended scrollback to use when viewing the scrollback buffer in a pager
(:iss:`970`)
- Fix the ``*_with_cwd`` actions using the cwd of the overlay window rather
than the underlying window's cwd (:iss:`1045`)
0.12.3 [2018-09-29]
------------------------------

View File

@ -240,8 +240,15 @@ class Boss:
def new_os_window(self, *args):
self._new_os_window(args)
def new_os_window_with_cwd(self, *args):
@property
def active_window_for_cwd(self):
w = self.active_window
if w is not None and w.overlay_for is not None and w.overlay_for in self.window_id_map:
w = self.window_id_map[w.overlay_for]
return w
def new_os_window_with_cwd(self, *args):
w = self.active_window_for_cwd
cwd_from = w.child.pid if w is not None else None
self._new_os_window(args, cwd_from)
@ -878,7 +885,7 @@ class Boss:
self._create_tab(args)
def new_tab_with_cwd(self, *args):
w = self.active_window
w = self.active_window_for_cwd
cwd_from = w.child.pid if w is not None else None
self._create_tab(args, cwd_from=cwd_from)
@ -894,7 +901,7 @@ class Boss:
self._new_window(args)
def new_window_with_cwd(self, *args):
w = self.active_window
w = self.active_window_for_cwd
if w is None:
return self.new_window(*args)
cwd_from = w.child.pid if w is not None else None