Fix terminal resize issue and race condition. Bump version to 0.3.27
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "textual-webterm"
|
||||
version = "0.3.26"
|
||||
version = "0.3.27"
|
||||
description = "Serve terminal sessions over the web"
|
||||
authors = ["Will McGugan <will@textualize.io>"]
|
||||
license = "MIT"
|
||||
|
||||
@@ -851,7 +851,7 @@ class LocalServer:
|
||||
<style>
|
||||
html, body {{ width: 100%; height: 100%; }}
|
||||
body {{ background: #0c181f; margin: 0; padding: 0; overflow: hidden; }}
|
||||
.textual-terminal {{ width: 100%; height: 100%; }}
|
||||
.textual-terminal {{ width: 100%; height: 100%; display: block; overflow: hidden; }}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -146,8 +146,8 @@ class WebTerminal {
|
||||
fit(): void {
|
||||
try {
|
||||
this.fitAddon.fit();
|
||||
} catch {
|
||||
// Ignore fit errors during initialization
|
||||
} catch (e) {
|
||||
console.warn("Fit failed:", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,7 +188,8 @@ class WebTerminal {
|
||||
const dims = (() => {
|
||||
try {
|
||||
return this.fitAddon.proposeDimensions();
|
||||
} catch {
|
||||
} catch (e) {
|
||||
console.warn("proposeDimensions failed:", e);
|
||||
return undefined;
|
||||
}
|
||||
})();
|
||||
|
||||
@@ -114,8 +114,9 @@ class TerminalSession(Session):
|
||||
if self.master_fd is None:
|
||||
return
|
||||
loop = asyncio.get_running_loop()
|
||||
width, height = await loop.run_in_executor(None, self._get_terminal_size)
|
||||
# Hold lock during PTY read to ensure consistency with concurrent set_terminal_size
|
||||
async with self._screen_lock:
|
||||
width, height = await loop.run_in_executor(None, self._get_terminal_size)
|
||||
if self._screen.columns != width or self._screen.lines != height:
|
||||
log.debug("Syncing pyte screen from %dx%d to %dx%d",
|
||||
self._screen.columns, self._screen.lines, width, height)
|
||||
@@ -125,12 +126,13 @@ class TerminalSession(Session):
|
||||
|
||||
async def set_terminal_size(self, width: int, height: int) -> None:
|
||||
"""Set terminal size."""
|
||||
loop = asyncio.get_running_loop()
|
||||
# Hold lock during PTY write to ensure consistency with concurrent _sync_pyte_to_pty
|
||||
async with self._screen_lock:
|
||||
self._last_width = width
|
||||
self._last_height = height
|
||||
loop = asyncio.get_running_loop()
|
||||
await loop.run_in_executor(None, self._set_terminal_size, width, height)
|
||||
# Resize pyte screen to match
|
||||
async with self._screen_lock:
|
||||
self._screen.resize(height, width)
|
||||
|
||||
async def force_redraw(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user