fix: complete readline prompt coverage

This commit is contained in:
Haoran
2026-08-25 21:56:24 +08:00
parent b99447946d
commit 922265145b
29 changed files with 387 additions and 191 deletions

View File

@@ -40,6 +40,12 @@ import subprocess
import time
from pathlib import Path
try:
import readline
readline.parse_and_bind('set bind-tty-special-chars off')
except ImportError:
pass
from anthropic import Anthropic
from dotenv import load_dotenv
@@ -247,7 +253,8 @@ if __name__ == "__main__":
history = []
while True:
try:
query = input("\033[36ms06 >> \033[0m")
# \001/\002 tell Readline the ANSI escapes have zero display width.
query = input("\001\033[36m\002s06 >> \001\033[0m\002")
except (EOFError, KeyboardInterrupt):
break
if query.strip().lower() in ("q", "exit", ""):