fix: pyte scroll_history è int, non list

- Corretto accesso a screen.scroll_history
- Usato screen.display per il contenuto
This commit is contained in:
opencode committed 2026-03-24 17:42:08 +01:00
1 parent 39b9288773
commit b6e8864829
1 file changed
+10 -4
+10 -4
View File
@@ -103,9 +103,10 @@ class TerminalUI:
if clean: # Solo linee non vuote
sys.stdout.write(clean + "\n")
# Status bar
# Status bar - scroll_history è un int, lines contiene il contenuto
status_color = "\033[1;34m"
scroll_info = f" Scrollback: {len(self.screen.scroll_history)} linee | Modalità: {self.mode} "
total_lines = len(self.screen.lines) + (self.scrollback if hasattr(self, 'scrollback') else 10000)
scroll_info = f" Linee buffer: ~{total_lines} | Modalità: {self.mode} "
if self.mode == "scroll":
scroll_info += f" | Offset: {self.scroll_offset} | q=exit scroll | ENTER=exit "
else:
@@ -126,7 +127,12 @@ class TerminalUI:
def _get_visible_content(self) -> list:
"""Ottieni contenuto visibile considerando lo scroll"""
all_lines = list(self.screen.scroll_history) + list(self.screen.display)
# In pyte: screen.lines contiene le linee correnti
# screen.display è la rappresentazione visibile corrente
# Non c'è uno scroll_history come lista - dobbiamo tenere il nostro buffer
# Usa il contenuto corrente dello screen
all_lines = list(self.screen.display)
if not all_lines:
return []
@@ -278,7 +284,7 @@ class TerminalUI:
seq = os.read(fd, 2).decode('utf-8', errors='replace')
if seq == '[5~': # PgUp
self.mode = "scroll"
self.scroll_offset = max(0, len(self.screen.scroll_history) + len(self.screen.display) - self.rows + 5)
self.scroll_offset = max(0, len(self.screen.display) - self.rows + 5)
self._draw()
continue
elif seq == '[6~': # PgDn