Reset the terminal before opening the LXC shell
Write ESC c, the sequence `reset` sends, inside suspend() right before ssh. The container shell then starts on a clean screen with no leftover TUI terminal modes. It runs locally, so the container does not need `reset` installed and `pct enter` is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
40feb125b4
commit
cccdaf7209
3 files changed
+26
No files matched your search
@@ -1,6 +1,7 @@
|
||||
"""Textual app for managing Proxmox guests through cv4pve-cli."""
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
from textual import work
|
||||
from textual.app import App, ComposeResult, SuspendNotSupported
|
||||
@@ -358,6 +359,7 @@ class GuestApp(App):
|
||||
try:
|
||||
with self.suspend():
|
||||
try: # inside: Textual's suspend() skips the resume if its body raises
|
||||
_reset_terminal()
|
||||
code = subprocess.run(cmd, check=False).returncode
|
||||
except OSError as exc:
|
||||
error = _message(exc)
|
||||
@@ -426,6 +428,12 @@ class GuestApp(App):
|
||||
self._start_job(guest, "edit", job)
|
||||
|
||||
|
||||
def _reset_terminal() -> None:
|
||||
"""Full terminal reset (ESC c, what `reset` sends): clean screen, no leftover TUI modes."""
|
||||
sys.stdout.write("\033c")
|
||||
sys.stdout.flush()
|
||||
|
||||
|
||||
def _scaled(value, unit: int):
|
||||
return "-" if value is None else round(value / unit)
|
||||
|
||||
|
||||
Reference in new issue
Block a user