Fix scroll-hold drift, ignore input while too small and redraw scrolls immediately

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
This commit is contained in:
Debian
2026-09-16 21:27:28 +02:00
co-authored by Sisyphus
parent 71bd740d78
commit b641eb4e45
+14
View File
@@ -586,6 +586,9 @@ class UIManager:
key_seen = True key_seen = True
if key == curses.KEY_RESIZE: if key == curses.KEY_RESIZE:
self.handle_resize() self.handle_resize()
elif self.too_small:
# Warning screen: ignore typing and scrolling, only resizes act
continue
elif key == curses.KEY_PPAGE: elif key == curses.KEY_PPAGE:
self.scroll_output(self._page_rows()) self.scroll_output(self._page_rows())
elif key == curses.KEY_NPAGE: elif key == curses.KEY_NPAGE:
@@ -625,6 +628,7 @@ class UIManager:
return return
self._draw_output() self._draw_output()
self._draw_divider() self._draw_divider()
self._flush()
# --- output --- # --- output ---
@@ -646,8 +650,17 @@ class UIManager:
pieces.pop() pieces.pop()
new_lines = [] new_lines = []
continued_delta = 0
for piece in pieces: for piece in pieces:
if self.line_open: if self.line_open:
if not self.too_small and self.scroll_offset > 0:
# The continued line can gain wrapped rows; count them so a
# scrolled-back view stays still
_, width = self.output_window.getmaxyx()
rows_before = len(wrap_colored(self.output_lines[-1], width))
self.output_lines[-1] += piece
continued_delta += len(wrap_colored(self.output_lines[-1], width)) - rows_before
else:
self.output_lines[-1] += piece self.output_lines[-1] += piece
self.line_open = False self.line_open = False
else: else:
@@ -663,6 +676,7 @@ class UIManager:
_, width = self.output_window.getmaxyx() _, width = self.output_window.getmaxyx()
for line in new_lines: for line in new_lines:
self.scroll_offset += len(wrap_colored(line, width)) self.scroll_offset += len(wrap_colored(line, width))
self.scroll_offset += continued_delta
self._draw_output() self._draw_output()
self._draw_divider() self._draw_divider()