Fix TUI apps (mc, htop, vim) freezing in SSH terminal
- Remove LNM mode that corrupted cursor positioning for TUI programs - Add render debouncing (~60fps) to prevent UI thread blocking - Add data batching in terminal tab to reduce render calls - Increase SSH recv buffer from 4KB to 64KB Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -30,6 +30,10 @@ class TerminalTab(ctk.CTkFrame):
|
||||
self._terminal.pack(fill="both", expand=True, padx=5, pady=5)
|
||||
self._terminal.set_status(t("term_disconnected"), "#888888")
|
||||
|
||||
# Data batching buffer
|
||||
self._data_buffer = bytearray()
|
||||
self._flush_after_id = None
|
||||
|
||||
def set_server(self, alias: str | None):
|
||||
if alias == self._current_alias:
|
||||
return
|
||||
@@ -84,7 +88,16 @@ class TerminalTab(ctk.CTkFrame):
|
||||
self._session = None
|
||||
|
||||
def _on_data_received(self, data: bytes):
|
||||
self.after(0, lambda d=data: self._terminal.feed(d))
|
||||
self._data_buffer.extend(data)
|
||||
if self._flush_after_id is None:
|
||||
self._flush_after_id = self.after(8, self._flush_data_buffer)
|
||||
|
||||
def _flush_data_buffer(self):
|
||||
self._flush_after_id = None
|
||||
if self._data_buffer:
|
||||
chunk = bytes(self._data_buffer)
|
||||
self._data_buffer.clear()
|
||||
self._terminal.feed(chunk)
|
||||
|
||||
def _on_disconnected(self):
|
||||
if self._intentional_disconnect:
|
||||
|
||||
Reference in New Issue
Block a user