From 715f7985c73fed6564aa35448ade976f59a885ca Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 3 Oct 2018 19:26:01 +0530 Subject: [PATCH] Fix the ``*_with_cwd`` actions using the cwd of the overlay window rather than the underlying window's cwd Fix #1045 --- docs/changelog.rst | 3 +++ kitty/boss.py | 13 ++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 0320d047a..ed2db627f 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -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] ------------------------------ diff --git a/kitty/boss.py b/kitty/boss.py index 73e1a8214..091be2c4a 100644 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -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