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:
@@ -586,6 +586,9 @@ class UIManager:
|
||||
key_seen = True
|
||||
if key == curses.KEY_RESIZE:
|
||||
self.handle_resize()
|
||||
elif self.too_small:
|
||||
# Warning screen: ignore typing and scrolling, only resizes act
|
||||
continue
|
||||
elif key == curses.KEY_PPAGE:
|
||||
self.scroll_output(self._page_rows())
|
||||
elif key == curses.KEY_NPAGE:
|
||||
@@ -625,6 +628,7 @@ class UIManager:
|
||||
return
|
||||
self._draw_output()
|
||||
self._draw_divider()
|
||||
self._flush()
|
||||
|
||||
# --- output ---
|
||||
|
||||
@@ -646,9 +650,18 @@ class UIManager:
|
||||
pieces.pop()
|
||||
|
||||
new_lines = []
|
||||
continued_delta = 0
|
||||
for piece in pieces:
|
||||
if self.line_open:
|
||||
self.output_lines[-1] += piece
|
||||
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.line_open = False
|
||||
else:
|
||||
self.output_lines.append(piece)
|
||||
@@ -663,6 +676,7 @@ class UIManager:
|
||||
_, width = self.output_window.getmaxyx()
|
||||
for line in new_lines:
|
||||
self.scroll_offset += len(wrap_colored(line, width))
|
||||
self.scroll_offset += continued_delta
|
||||
|
||||
self._draw_output()
|
||||
self._draw_divider()
|
||||
|
||||
Reference in New Issue
Block a user