From 08862c73e72df6fb51a46331d697f5cde37da4ce Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Fri, 9 Aug 2024 18:34:54 -0400 Subject: [PATCH] fix: Remove unnecessary paginate parameter from cmd_diff method --- aider/coders/base_coder.py | 2 +- aider/commands.py | 20 +++++--------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/aider/coders/base_coder.py b/aider/coders/base_coder.py index 7a3fd0990..f40d5d96b 100755 --- a/aider/coders/base_coder.py +++ b/aider/coders/base_coder.py @@ -1647,7 +1647,7 @@ class Coder: self.aider_commit_hashes.add(commit_hash) self.last_aider_commit_message = commit_message if self.show_diffs: - self.commands.cmd_diff(paginate=False) + self.commands.cmd_diff() self.io.tool_output(f"You can use /undo to revert and discard commit {commit_hash}.") diff --git a/aider/commands.py b/aider/commands.py index 8f756668a..91005e5d4 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -144,11 +144,8 @@ class Commands: self.io.tool_output("... done.") if paginate: - # Use pypager to show the content - source = StringSource(content) - pager = Pager() - pager.add_source(source) - pager.run() + with self.io.console.pager(): + self.io.console.print(content) return content @@ -470,7 +467,7 @@ class Commands: if self.coder.main_model.send_undo_reply: return prompts.undo_command_reply - def cmd_diff(self, args="", paginate=True): + def cmd_diff(self, args=""): "Display the diff of the last aider commit" if not self.coder.repo: self.io.tool_error("No git repository found.") @@ -489,15 +486,8 @@ class Commands: "HEAD", ) - 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) + # 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: