fix: keep debugger pane maximized

This commit is contained in:
user
2026-07-17 17:07:08 +02:00
parent 8c7a67c471
commit 4dda6de387
+36
View File
@@ -4955,6 +4955,7 @@ def respawn_tmux_session_pane(
shell_command: str | None,
dry_run: bool = False,
force: bool = False,
stem_instance: str | None = None,
) -> dict[str, str]:
name, pane_id, _ = resolve_tmux_session_pane(raw_target, force=force)
shell = os.environ.get("SHELL", "/bin/bash")
@@ -4972,12 +4973,42 @@ def respawn_tmux_session_pane(
}
if not dry_run:
subprocess.run(command, check=True)
# A debugger session contains an inner tmux and Neovim. If its host
# pane remains in a split, the inner client inherits only that short
# height and leaves an unusable empty area below the editor. Zoom the
# replacement pane after every attach/refresh/reset so it receives the
# full host window height. A later user Ctrl-a z simply restores the
# ordinary host-pane layout.
zoom_state = subprocess.run(
["tmux", "display-message", "-p", "-t", pane_id, "#{window_zoomed_flag}"],
check=False,
text=True,
capture_output=True,
)
if zoom_state.returncode == 0 and zoom_state.stdout.strip() != "1":
subprocess.run(
["tmux", "resize-pane", "-Z", "-t", pane_id],
check=False,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
subprocess.run(
["tmux", "set-option", "-p", "-t", pane_id, "@stem_role", "debugger" if shell_command else "shell"],
check=False,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
instance_option = ["tmux", "set-option", "-p", "-t", pane_id]
if shell_command and stem_instance:
instance_option.extend(["@stem_instance", stem_instance])
else:
instance_option.extend(["-u", "@stem_instance"])
subprocess.run(
instance_option,
check=False,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
return details
@@ -5216,6 +5247,7 @@ def run_session(config: WorkspaceConfig, args: argparse.Namespace) -> None:
None,
dry_run=args.dry_run,
force=args.force_pane,
stem_instance=session.instance,
)
print_session_target(session)
print_key_values(details)
@@ -5266,6 +5298,7 @@ def run_session(config: WorkspaceConfig, args: argparse.Namespace) -> None:
debug_command,
dry_run=args.dry_run,
force=args.force_pane,
stem_instance=session.instance,
)
print_key_values(pane_details)
if args.dry_run:
@@ -5300,6 +5333,7 @@ def run_session(config: WorkspaceConfig, args: argparse.Namespace) -> None:
debug_command,
dry_run=args.dry_run,
force=args.force_pane,
stem_instance=session.instance,
)
print_key_values(pane_details)
if args.dry_run:
@@ -5341,6 +5375,7 @@ def run_session(config: WorkspaceConfig, args: argparse.Namespace) -> None:
pane_command,
dry_run=args.dry_run,
force=args.force_pane,
stem_instance=session.instance,
)
print_key_values(pane_details)
elif record is None and not args.dry_run and (prepared_stage is None or online):
@@ -5372,6 +5407,7 @@ def run_session(config: WorkspaceConfig, args: argparse.Namespace) -> None:
attach_command,
dry_run=args.dry_run,
force=args.force_pane,
stem_instance=session.instance,
)
print_key_values(pane_details)
if args.dry_run: