fix: keep debugger pane maximized
This commit is contained in:
@@ -4955,6 +4955,7 @@ def respawn_tmux_session_pane(
|
|||||||
shell_command: str | None,
|
shell_command: str | None,
|
||||||
dry_run: bool = False,
|
dry_run: bool = False,
|
||||||
force: bool = False,
|
force: bool = False,
|
||||||
|
stem_instance: str | None = None,
|
||||||
) -> dict[str, str]:
|
) -> dict[str, str]:
|
||||||
name, pane_id, _ = resolve_tmux_session_pane(raw_target, force=force)
|
name, pane_id, _ = resolve_tmux_session_pane(raw_target, force=force)
|
||||||
shell = os.environ.get("SHELL", "/bin/bash")
|
shell = os.environ.get("SHELL", "/bin/bash")
|
||||||
@@ -4972,12 +4973,42 @@ def respawn_tmux_session_pane(
|
|||||||
}
|
}
|
||||||
if not dry_run:
|
if not dry_run:
|
||||||
subprocess.run(command, check=True)
|
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(
|
subprocess.run(
|
||||||
["tmux", "set-option", "-p", "-t", pane_id, "@stem_role", "debugger" if shell_command else "shell"],
|
["tmux", "set-option", "-p", "-t", pane_id, "@stem_role", "debugger" if shell_command else "shell"],
|
||||||
check=False,
|
check=False,
|
||||||
stdout=subprocess.DEVNULL,
|
stdout=subprocess.DEVNULL,
|
||||||
stderr=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
|
return details
|
||||||
|
|
||||||
|
|
||||||
@@ -5216,6 +5247,7 @@ def run_session(config: WorkspaceConfig, args: argparse.Namespace) -> None:
|
|||||||
None,
|
None,
|
||||||
dry_run=args.dry_run,
|
dry_run=args.dry_run,
|
||||||
force=args.force_pane,
|
force=args.force_pane,
|
||||||
|
stem_instance=session.instance,
|
||||||
)
|
)
|
||||||
print_session_target(session)
|
print_session_target(session)
|
||||||
print_key_values(details)
|
print_key_values(details)
|
||||||
@@ -5266,6 +5298,7 @@ def run_session(config: WorkspaceConfig, args: argparse.Namespace) -> None:
|
|||||||
debug_command,
|
debug_command,
|
||||||
dry_run=args.dry_run,
|
dry_run=args.dry_run,
|
||||||
force=args.force_pane,
|
force=args.force_pane,
|
||||||
|
stem_instance=session.instance,
|
||||||
)
|
)
|
||||||
print_key_values(pane_details)
|
print_key_values(pane_details)
|
||||||
if args.dry_run:
|
if args.dry_run:
|
||||||
@@ -5300,6 +5333,7 @@ def run_session(config: WorkspaceConfig, args: argparse.Namespace) -> None:
|
|||||||
debug_command,
|
debug_command,
|
||||||
dry_run=args.dry_run,
|
dry_run=args.dry_run,
|
||||||
force=args.force_pane,
|
force=args.force_pane,
|
||||||
|
stem_instance=session.instance,
|
||||||
)
|
)
|
||||||
print_key_values(pane_details)
|
print_key_values(pane_details)
|
||||||
if args.dry_run:
|
if args.dry_run:
|
||||||
@@ -5341,6 +5375,7 @@ def run_session(config: WorkspaceConfig, args: argparse.Namespace) -> None:
|
|||||||
pane_command,
|
pane_command,
|
||||||
dry_run=args.dry_run,
|
dry_run=args.dry_run,
|
||||||
force=args.force_pane,
|
force=args.force_pane,
|
||||||
|
stem_instance=session.instance,
|
||||||
)
|
)
|
||||||
print_key_values(pane_details)
|
print_key_values(pane_details)
|
||||||
elif record is None and not args.dry_run and (prepared_stage is None or online):
|
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,
|
attach_command,
|
||||||
dry_run=args.dry_run,
|
dry_run=args.dry_run,
|
||||||
force=args.force_pane,
|
force=args.force_pane,
|
||||||
|
stem_instance=session.instance,
|
||||||
)
|
)
|
||||||
print_key_values(pane_details)
|
print_key_values(pane_details)
|
||||||
if args.dry_run:
|
if args.dry_run:
|
||||||
|
|||||||
Reference in New Issue
Block a user