mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 01:04:59 +00:00
aider: Add editingmode
argument to InputOutput
class for EditingMode.VI
and EditingMode.EMACS
.
# Aider chat conversation: USER: `InputOutput` should accept an arg editingmode of either EditingMode.VI EditingMode.EMACS ASSISTANT: To add the `editingmode` argument to the `InputOutput` class, we need to: 1. Import `EditingMode` from `prompt_toolkit`. 2. Add the `editingmode` parameter to the `__init__` method. 3. Use the `editingmode` parameter when creating the `PromptSession`. Here are the *SEARCH/REPLACE* blocks: aider/io.py ```python <<<<<<< SEARCH from prompt_toolkit.shortcuts import CompleteStyle, PromptSession, prompt ======= from prompt_toolkit.shortcuts import CompleteStyle, PromptSession, prompt, EditingMode >>>>>>> REPLACE ``` aider/io.py ```python <<<<<<< SEARCH ): ======= editingmode=EditingMode.EMACS, ): self.editingmode = editingmode >>>>>>> REPLACE ``` aider/io.py ```python <<<<<<< SEARCH session = PromptSession(key_bindings=kb, **session_kwargs) ======= session = PromptSession(key_bindings=kb, editing_mode=self.editingmode, **session_kwargs) >>>>>>> REPLACE ```
This commit is contained in:
parent
8ebf7cd131
commit
eae9a1e065
1 changed files with 4 additions and 2 deletions
|
@ -8,7 +8,7 @@ from prompt_toolkit.completion import Completer, Completion
|
|||
from prompt_toolkit.history import FileHistory
|
||||
from prompt_toolkit.key_binding import KeyBindings
|
||||
from prompt_toolkit.lexers import PygmentsLexer
|
||||
from prompt_toolkit.shortcuts import CompleteStyle, PromptSession, prompt
|
||||
from prompt_toolkit.shortcuts import CompleteStyle, PromptSession, prompt, EditingMode
|
||||
from prompt_toolkit.styles import Style
|
||||
from pygments.lexers import MarkdownLexer, guess_lexer_for_filename
|
||||
from pygments.token import Token
|
||||
|
@ -106,7 +106,9 @@ class InputOutput:
|
|||
tool_error_color="red",
|
||||
encoding="utf-8",
|
||||
dry_run=False,
|
||||
editingmode=EditingMode.EMACS,
|
||||
):
|
||||
self.editingmode = editingmode
|
||||
no_color = os.environ.get("NO_COLOR")
|
||||
if no_color is not None and no_color != "":
|
||||
pretty = False
|
||||
|
@ -234,7 +236,7 @@ class InputOutput:
|
|||
def _(event):
|
||||
event.current_buffer.insert_text("\n")
|
||||
|
||||
session = PromptSession(key_bindings=kb, **session_kwargs)
|
||||
session = PromptSession(key_bindings=kb, editing_mode=self.editingmode, **session_kwargs)
|
||||
line = session.prompt()
|
||||
|
||||
if line and line[0] == "{" and not multiline_input:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue