Render with pyte.HistoryScreen and show scrollback + screen, so large output (ls -la, cat, etc.) can be scrolled up to read. Auto-scroll to the bottom only when already at the bottom; preserve position when the user has scrolled up. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,11 @@ All notable changes to RigDoctor are recorded here. Format follows
|
|||||||
(`MAJOR.MINOR.PATCH`, pre-1.0). `__version__` and `pyproject.toml` must match the git
|
(`MAJOR.MINOR.PATCH`, pre-1.0). `__version__` and `pyproject.toml` must match the git
|
||||||
release tag (so the auto-updater, D18, can compare versions).
|
release tag (so the auto-updater, D18, can compare versions).
|
||||||
|
|
||||||
|
## [0.7.3] - 2026-05-21
|
||||||
|
### Fixed
|
||||||
|
- Shared terminal now has **scrollback** — large output (e.g. `ls -la`) can be scrolled up to
|
||||||
|
read; it keeps a history buffer and only auto-scrolls to the bottom when you're already there.
|
||||||
|
|
||||||
## [0.7.2] - 2026-05-21
|
## [0.7.2] - 2026-05-21
|
||||||
### Changed
|
### Changed
|
||||||
- Removed the GUI **Inventory** tab — use the CLI `rigdoctor inventory` instead. (Inventory is
|
- Removed the GUI **Inventory** tab — use the CLI `rigdoctor inventory` instead. (Inventory is
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "rigdoctor"
|
name = "rigdoctor"
|
||||||
version = "0.7.2"
|
version = "0.7.3"
|
||||||
description = "Modular hardware monitoring & crash diagnostics for Linux gamers."
|
description = "Modular hardware monitoring & crash diagnostics for Linux gamers."
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.11"
|
requires-python = ">=3.11"
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
"""RigDoctor — modular hardware monitoring & crash diagnostics for Linux gamers."""
|
"""RigDoctor — modular hardware monitoring & crash diagnostics for Linux gamers."""
|
||||||
|
|
||||||
__version__ = "0.7.2"
|
__version__ = "0.7.3"
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class TerminalView(QPlainTextEdit):
|
|||||||
self.setUndoRedoEnabled(False)
|
self.setUndoRedoEnabled(False)
|
||||||
self.setMinimumHeight(260)
|
self.setMinimumHeight(260)
|
||||||
self._rows, self._cols = rows, cols
|
self._rows, self._cols = rows, cols
|
||||||
self._screen = pyte.Screen(cols, rows)
|
self._screen = pyte.HistoryScreen(cols, rows, history=1000, ratio=0.5)
|
||||||
self._stream = pyte.ByteStream(self._screen)
|
self._stream = pyte.ByteStream(self._screen)
|
||||||
|
|
||||||
def grid(self) -> tuple[int, int]:
|
def grid(self) -> tuple[int, int]:
|
||||||
@@ -38,15 +38,24 @@ class TerminalView(QPlainTextEdit):
|
|||||||
self._screen.reset()
|
self._screen.reset()
|
||||||
self._render()
|
self._render()
|
||||||
|
|
||||||
|
def _row_text(self, row) -> str:
|
||||||
|
return "".join(row[x].data for x in range(self._cols)).rstrip()
|
||||||
|
|
||||||
def _render(self) -> None:
|
def _render(self) -> None:
|
||||||
self.setPlainText("\n".join(self._screen.display))
|
bar = self.verticalScrollBar()
|
||||||
# Place the caret at the terminal's actual cursor (row, col) and keep it in view.
|
at_bottom = bar.value() >= bar.maximum() - 2
|
||||||
cursor = self.textCursor()
|
prev = bar.value()
|
||||||
cursor.movePosition(QTextCursor.MoveOperation.Start)
|
history = [self._row_text(r) for r in self._screen.history.top] # scrollback
|
||||||
cursor.movePosition(QTextCursor.MoveOperation.Down, QTextCursor.MoveMode.MoveAnchor, self._screen.cursor.y)
|
self.setPlainText("\n".join(history + list(self._screen.display)))
|
||||||
cursor.movePosition(QTextCursor.MoveOperation.Right, QTextCursor.MoveMode.MoveAnchor, self._screen.cursor.x)
|
if at_bottom: # follow output; place caret at the real (row, col)
|
||||||
self.setTextCursor(cursor)
|
cursor = self.textCursor()
|
||||||
self.ensureCursorVisible()
|
cursor.movePosition(QTextCursor.MoveOperation.Start)
|
||||||
|
cursor.movePosition(QTextCursor.MoveOperation.Down, QTextCursor.MoveMode.MoveAnchor, len(history) + self._screen.cursor.y)
|
||||||
|
cursor.movePosition(QTextCursor.MoveOperation.Right, QTextCursor.MoveMode.MoveAnchor, self._screen.cursor.x)
|
||||||
|
self.setTextCursor(cursor)
|
||||||
|
self.ensureCursorVisible()
|
||||||
|
else: # user scrolled up to read — keep their place
|
||||||
|
bar.setValue(prev)
|
||||||
|
|
||||||
def resizeEvent(self, event): # noqa: N802 (Qt override)
|
def resizeEvent(self, event): # noqa: N802 (Qt override)
|
||||||
super().resizeEvent(event)
|
super().resizeEvent(event)
|
||||||
|
|||||||
Reference in New Issue
Block a user