diff --git a/HISTORY.md b/HISTORY.md index 94b5fefa5..c48c726a9 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,9 @@ # Release history +### GitHub main branch + +- + ### v0.9.0 - Support for the OpenAI models in [Azure](https://aider.chat/docs/faq.html#azure) diff --git a/README.md b/README.md index 729996741..b54cb69a9 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ Aider has some ability to help GPT figure out which files to edit all by itself, * Large changes are best performed as a sequence of thoughtful bite sized steps, where you plan out the approach and overall design. Walk GPT through changes like you might with a junior dev. Ask for a refactor to prepare, then ask for the actual change. Spend the time to ask for code quality/structure improvements. * Use Control-C to safely interrupt GPT if it isn't providing a useful response. The partial response remains in the conversation, so you can refer to it when you reply to GPT with more information or direction. * Use the `/run` command to run tests, linters, etc and show the output to GPT so it can fix any issues. -* Enter a multiline chat message by entering `{` alone on the first line. End the multiline message with `}` alone on the last line. +* Use Meta-ENTER (Esc+ENTER in some environments) to enter multiline chat messages. Or enter `{` alone on the first line to start a multiline message and `}` alone on the last line to end it. * If your code is throwing an error, share the error output with GPT using `/run` or by pasting it into the chat. Let GPT figure out and fix the bug. * GPT knows about a lot of standard tools and libraries, but may get some of the fine details wrong about APIs and function arguments. You can paste doc snippets into the chat to resolve these issues. * [Aider will notice if you launch it on a git repo with uncommitted changes and offer to commit them before proceeding](https://aider.chat/docs/faq.html#how-does-aider-use-git). diff --git a/aider/coders/base_coder.py b/aider/coders/base_coder.py index f4b000acf..5ceea559f 100755 --- a/aider/coders/base_coder.py +++ b/aider/coders/base_coder.py @@ -407,8 +407,8 @@ class Coder: if cmds: matching_commands, _, _ = cmds if len(matching_commands) == 1: - cmd = matching_commands[0] - if cmd in ("/exit", "/commit"): + cmd = matching_commands[0][1:] + if cmd in "add clear commit diff drop exit help ls tokens".split(): return if not self.dirty_commits: diff --git a/aider/io.py b/aider/io.py index c96f65d9a..086813b61 100644 --- a/aider/io.py +++ b/aider/io.py @@ -5,6 +5,7 @@ from pathlib import Path 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.styles import Style @@ -203,7 +204,13 @@ class InputOutput: if self.input_history_file is not None: session_kwargs["history"] = FileHistory(self.input_history_file) - session = PromptSession(**session_kwargs) + kb = KeyBindings() + + @kb.add("escape", "c-m", eager=True) + def _(event): + event.current_buffer.insert_text("\n") + + session = PromptSession(key_bindings=kb, **session_kwargs) line = session.prompt() if line and line[0] == "{" and not multiline_input: diff --git a/docs/install.md b/docs/install.md index 18f41196a..c607d7da6 100644 --- a/docs/install.md +++ b/docs/install.md @@ -1,6 +1,12 @@ # Installing aider +- [pip install aider-chat](#pip-install-aider-chat) +- [Provide your OpenAI API key](#provide-your-openai-api-key) +- [Install git](#install-git) +- [Install universal ctags (optional)](#install-universal-ctags-optional) +- [Add aider to your editor (optional)](#add-aider-to-your-editor-optional) + ## pip install aider-chat Install the “aider-chat” package with pip from one of these sources: diff --git a/tests/test_coder.py b/tests/test_coder.py index 80a92f902..41ae7e644 100644 --- a/tests/test_coder.py +++ b/tests/test_coder.py @@ -24,6 +24,26 @@ class TestCoder(unittest.TestCase): def tearDown(self): self.patcher.stop() + def test_should_dirty_commit(self): + # Mock the IO object + mock_io = MagicMock() + + with GitTemporaryDirectory(): + repo = git.Repo(Path.cwd()) + fname = Path("new.txt") + fname.touch() + repo.git.add(str(fname)) + repo.git.commit("-m", "new") + + # Initialize the Coder object with the mocked IO and mocked repo + coder = Coder.create(models.GPT4, None, mock_io) + + fname.write_text("hi") + self.assertTrue(coder.should_dirty_commit("hi")) + + self.assertFalse(coder.should_dirty_commit("/exit")) + self.assertFalse(coder.should_dirty_commit("/help")) + def test_check_for_file_mentions(self): # Mock the IO object mock_io = MagicMock()