Remove references to overlay_for from boss

This commit is contained in:
Kovid Goyal 2020-05-05 17:08:46 +05:30
parent 81b28bc1bd
commit 79a780004f
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 19 additions and 8 deletions

View File

@ -304,10 +304,9 @@ class Boss:
@property
def active_window_for_cwd(self) -> Optional[Window]:
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
t = self.active_tab
if t is not None:
return t.active_window_for_cwd
def new_os_window_with_cwd(self, *args: str) -> None:
w = self.active_window_for_cwd
@ -752,7 +751,7 @@ class Boss:
def display_scrollback(self, window: Window, data: Optional[bytes], cmd: Optional[List[str]]) -> None:
tab = self.active_tab
if tab is not None and window.overlay_for is None:
if tab is not None:
tab.new_special_window(
SpecialWindow(cmd, data, _('History'), overlay_for=window.id),
copy_colors_from=self.active_window
@ -795,7 +794,7 @@ class Boss:
if end_kitten.no_ui:
return end_kitten(None, getattr(w, 'id', None), self)
if w is not None and tab is not None and w.overlay_for is None:
if w is not None and tab is not None:
args[0:0] = [config_dir, kitten]
if input_data is None:
type_of_input = end_kitten.type_of_input
@ -905,7 +904,7 @@ class Boss:
elif window_type == 'overlay':
w = self.active_window
tab = self.active_tab
if w is not None and tab is not None and w.overlay_for is None:
if w is not None and tab is not None:
tab.new_special_window(SpecialWindow(cmd, overlay_for=w.id))
else:
self._new_window(cmd)
@ -1047,7 +1046,7 @@ class Boss:
continue
arg = q
cmdline.append(arg)
overlay_for = w.id if w and as_overlay and w.overlay_for is None else None
overlay_for = w.id if w and as_overlay else None
return SpecialWindow(cmd, input_data, cwd_from=cwd_from, overlay_for=overlay_for, env=env)
def run_background_process(

View File

@ -167,6 +167,10 @@ class Tab: # {{{
def active_window(self) -> Optional[Window]:
return self.windows.active_window
@property
def active_window_for_cwd(self) -> Optional[Window]:
return self.windows.active_group_base
@property
def title(self) -> str:
return cast(str, getattr(self.active_window, 'title', appname))

View File

@ -191,6 +191,14 @@ class WindowList:
pass
return None
@property
def active_group_base(self) -> Optional[WindowType]:
try:
return self.id_map[self.groups[self.active_group_idx].base_window_id]
except IndexError:
pass
return None
def set_active_window_group_for(self, x: WindowOrId) -> None:
q = self.id_map[x] if isinstance(x, int) else x
for i, group in enumerate(self.groups):