mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-03 19:24:59 +00:00
feat: Add placeholder functionality to input prompts
This commit is contained in:
parent
60d82eddee
commit
48e7376002
1 changed files with 10 additions and 0 deletions
10
aider/io.py
10
aider/io.py
|
@ -198,6 +198,7 @@ class InputOutput:
|
||||||
editingmode=EditingMode.EMACS,
|
editingmode=EditingMode.EMACS,
|
||||||
fancy_input=True,
|
fancy_input=True,
|
||||||
):
|
):
|
||||||
|
self.placeholder = None
|
||||||
self.never_prompts = set()
|
self.never_prompts = set()
|
||||||
self.editingmode = editingmode
|
self.editingmode = editingmode
|
||||||
no_color = os.environ.get("NO_COLOR")
|
no_color = os.environ.get("NO_COLOR")
|
||||||
|
@ -427,8 +428,13 @@ class InputOutput:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if self.prompt_session:
|
if self.prompt_session:
|
||||||
|
# Use placeholder if set, then clear it
|
||||||
|
default = self.placeholder
|
||||||
|
self.placeholder = None
|
||||||
|
|
||||||
line = self.prompt_session.prompt(
|
line = self.prompt_session.prompt(
|
||||||
show,
|
show,
|
||||||
|
default=default,
|
||||||
completer=completer_instance,
|
completer=completer_instance,
|
||||||
reserve_space_for_menu=4,
|
reserve_space_for_menu=4,
|
||||||
complete_style=CompleteStyle.MULTI_COLUMN,
|
complete_style=CompleteStyle.MULTI_COLUMN,
|
||||||
|
@ -739,6 +745,10 @@ class InputOutput:
|
||||||
|
|
||||||
self.console.print(show_resp)
|
self.console.print(show_resp)
|
||||||
|
|
||||||
|
def set_placeholder(self, placeholder):
|
||||||
|
"""Set a one-time placeholder text for the next input prompt."""
|
||||||
|
self.placeholder = placeholder
|
||||||
|
|
||||||
def print(self, message=""):
|
def print(self, message=""):
|
||||||
print(message)
|
print(message)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue