diff --git a/aider/coder.py b/aider/coder.py index bf2ab8400..bced5fc7a 100755 --- a/aider/coder.py +++ b/aider/coder.py @@ -183,8 +183,9 @@ class Coder: inp = get_input(self.history_file, self.abs_fnames, self.commands) if inp.startswith("/"): - self.commands.run(inp) - return + inp = self.commands.run(inp) + if not inp: + return self.num_control_c = 0 diff --git a/aider/commands.py b/aider/commands.py index 97cf6f29f..bb9b05d65 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -39,7 +39,7 @@ class Commands: cmd_method_name = f"cmd_{cmd_name}" cmd_method = getattr(self, cmd_method_name, None) if cmd_method: - cmd_method(args) + return cmd_method(args) else: self.console.print(f"Error: Command {cmd_name} not found.") @@ -105,7 +105,11 @@ class Commands: ) return self.coder.repo.git.reset("--hard", "HEAD~1") - self.console.print(f"[red]Undid the last commit: {last_commit.message.strip()}") + self.console.print( + f"[red]Undid the last commit: {last_commit.message.strip()}\n" + ) + + return "I did not like those edits, so I did `git reset --hard HEAD~1` to discard them." def cmd_diff(self, args): "Display the diff of the last aider commit"