mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-24 14:25:00 +00:00
use colorama to work around buggy rich input
This commit is contained in:
parent
5ec57a221b
commit
936c5043fa
1 changed files with 4 additions and 6 deletions
10
coder.py
10
coder.py
|
@ -6,6 +6,7 @@ import readline
|
||||||
import traceback
|
import traceback
|
||||||
import argparse
|
import argparse
|
||||||
from rich.console import Console
|
from rich.console import Console
|
||||||
|
from colorama import Fore, Style
|
||||||
from rich.live import Live
|
from rich.live import Live
|
||||||
from rich.text import Text
|
from rich.text import Text
|
||||||
from rich.markdown import Markdown
|
from rich.markdown import Markdown
|
||||||
|
@ -52,7 +53,7 @@ class Coder:
|
||||||
|
|
||||||
self.check_for_local_edits(True)
|
self.check_for_local_edits(True)
|
||||||
|
|
||||||
self.console = Console(record=True)
|
self.console = Console()
|
||||||
self.colorize = colorize
|
self.colorize = colorize
|
||||||
|
|
||||||
def files_modified(self):
|
def files_modified(self):
|
||||||
|
@ -81,6 +82,7 @@ class Coder:
|
||||||
self.console.rule()
|
self.console.rule()
|
||||||
inp = ""
|
inp = ""
|
||||||
num_control_c = 0
|
num_control_c = 0
|
||||||
|
print(Fore.GREEN, end="\r")
|
||||||
while not inp.strip():
|
while not inp.strip():
|
||||||
try:
|
try:
|
||||||
inp = input("> ")
|
inp = input("> ")
|
||||||
|
@ -94,8 +96,7 @@ class Coder:
|
||||||
self.console.print("[bold red]^C again to quit")
|
self.console.print("[bold red]^C again to quit")
|
||||||
|
|
||||||
###
|
###
|
||||||
self.console.print(f"[green]> {inp.strip()}")
|
print(Style.RESET_ALL)
|
||||||
self.console.print()
|
|
||||||
|
|
||||||
readline.write_history_file(history_file)
|
readline.write_history_file(history_file)
|
||||||
return inp
|
return inp
|
||||||
|
@ -130,9 +131,6 @@ class Coder:
|
||||||
self.cur_messages = []
|
self.cur_messages = []
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
html = self.console.export_html()
|
|
||||||
Path("tmp.html").write_text(html)
|
|
||||||
|
|
||||||
inp = self.get_input()
|
inp = self.get_input()
|
||||||
if inp is None:
|
if inp is None:
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue