From f1d1248d4bb6326835af9ffb59e3f01810f0a83f Mon Sep 17 00:00:00 2001 From: opencode Date: Tue, 24 Mar 2026 15:37:38 +0100 Subject: [PATCH] fix: paginazione output con stile 'more' - Output mostrato in blocchi da 15 righe - Premi ENTER per continuare, 'q' per uscire - SepARATOR visivo tra pagine --- langcode.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/langcode.py b/langcode.py index 545058b..ec22fbf 100755 --- a/langcode.py +++ b/langcode.py @@ -169,11 +169,25 @@ Comandi disponibili: # Strip ANSI codes per terminali semplici clean_response = strip_ansi(response) - print(f"šŸ¤– {clean_response}\n") - # Info scroll per output lunghi - if len(clean_response) > 1000: - print("šŸ’” Suggerimento: scorri con Shift+PgUp / Shift+PgDn o mouse\n") + # Paginazione con 'more' style per output lunghi + lines = clean_response.split('\n') + if len(lines) > 15: + for i in range(0, len(lines), 15): + chunk = '\n'.join(lines[i:i+15]) + print(f"šŸ¤– {chunk}") + if i + 15 < len(lines): + print("\n" + "─" * 40) + print("Premi ENTER per continuare, 'q' per uscire: ", end="") + try: + user_char = input() + if user_char.lower() == 'q': + break + except: + break + print() + else: + print(f"šŸ¤– {clean_response}\n") except KeyboardInterrupt: print("\nšŸ‘‹ Arrivederci!")