def add_non_overlay_window(self, all_windows: WindowList, window: WindowType, location: Optional[str]) -> None: horizontal = self.default_axis_is_horizontal after = True if location is not None: if location == 'vsplit': horizontal = True elif location == 'hsplit': horizontal = False if location in ('before', 'first'): after = False aw = all_windows.active_window if aw is not None: ag = all_windows.active_group assert ag is not None group_id = ag.id pair = self.pairs_root.pair_for_window(group_id) if pair is not None: target_group = all_windows.add_window(window, next_to=aw, before=not after) pair.split_and_add(group_id, target_group.id, horizontal, after) return all_windows.add_window(window)
def add_window(self, all_windows: WindowList, window: WindowType, location: Optional[str] = None, overlay_for: Optional[int] = None) -> None: if overlay_for is not None and overlay_for in all_windows: all_windows.add_window(window, group_of=overlay_for) return if location == 'neighbor': location = 'after' self.add_non_overlay_window(all_windows, window, location)
def add_non_overlay_window(self, all_windows: WindowList, window: WindowType, location: Optional[str]) -> None: next_to: Optional[WindowType] = None before = False next_to = all_windows.active_window if location is not None: if location in ('after', 'vsplit', 'hsplit'): pass elif location == 'before': before = True elif location == 'first': before = True next_to = None elif location == 'last': next_to = None all_windows.add_window(window, next_to=next_to, before=before)