diff --git a/aider/commands.py b/aider/commands.py index 79f47a677..ca8a551fe 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -467,7 +467,7 @@ class Commands: if self.coder.main_model.send_undo_reply: return prompts.undo_command_reply - def cmd_diff(self, args=""): + def cmd_diff(self, args="", paginate=False): "Display the diff of the last aider commit" if not self.coder.repo: self.io.tool_error("No git repository found.") @@ -486,8 +486,15 @@ class Commands: "HEAD", ) - # don't use io.tool_output() because we don't want to log or further colorize - print(diff) + if paginate: + # Use pypager to show the content + source = StringSource(diff) + pager = Pager() + pager.add_source(source) + pager.run() + else: + # don't use io.tool_output() because we don't want to log or further colorize + print(diff) def quote_fname(self, fname): if " " in fname and '"' not in fname: