From b587a1c38ff1ff90397836e01a18e65996774a99 Mon Sep 17 00:00:00 2001 From: Matteo Landi Date: Thu, 8 May 2025 17:01:04 +0200 Subject: [PATCH 1/6] First stab --- aider/args.py | 5 +++++ aider/io.py | 28 +++++++++++++++++----------- aider/main.py | 1 + aider/website/docs/config/dotenv.md | 3 +++ 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/aider/args.py b/aider/args.py index 5b3fdf07faf..667d6557309 100644 --- a/aider/args.py +++ b/aider/args.py @@ -330,6 +330,11 @@ def get_parser(default_config_files, git_root): default="#00cc00", help="Set the color for user input (default: #00cc00)", ) + group.add_argument( + "--user-submitted-input-color", + default=None, + help="Set the color for user submitted input (default: #00cc00)", + ) group.add_argument( "--tool-output-color", default=None, diff --git a/aider/io.py b/aider/io.py index ed6f22d51ae..02bda52bb9b 100644 --- a/aider/io.py +++ b/aider/io.py @@ -243,6 +243,7 @@ def __init__( input=None, output=None, user_input_color="blue", + user_submitted_input_color=None, tool_output_color=None, tool_error_color="red", tool_warning_color="#FFA500", @@ -281,6 +282,9 @@ def __init__( pretty = False self.user_input_color = ensure_hash_prefix(user_input_color) if pretty else None + self.user_submitted_input_color = ( + ensure_hash_prefix(user_submitted_input_color) if pretty else None + ) self.tool_output_color = ensure_hash_prefix(tool_output_color) if pretty else None self.tool_error_color = ensure_hash_prefix(tool_error_color) if pretty else None self.tool_warning_color = ensure_hash_prefix(tool_warning_color) if pretty else None @@ -349,6 +353,7 @@ def __init__( "output": self.output, "lexer": PygmentsLexer(MarkdownLexer), "editing_mode": self.editingmode, + "erase_when_done": True, } if self.editingmode == EditingMode.VI: session_kwargs["cursor"] = ModalCursorShapeConfig() @@ -375,6 +380,7 @@ def _validate_color_settings(self): """Validate configured color strings and reset invalid ones.""" color_attributes = [ "user_input_color", + "user_submitted_input_color", "tool_output_color", "tool_error_color", "tool_warning_color", @@ -507,11 +513,11 @@ def write_text(self, filename, content, max_retries=5, initial_delay=0.1): raise def rule(self): - if self.pretty: - style = dict(style=self.user_input_color) if self.user_input_color else dict() - self.console.rule(**style) - else: - print() + if not self.pretty: + return "\n" + + columns = self.console.width + return "\n".join(["─" * columns, ""]) def interrupt_input(self): if self.prompt_session and self.prompt_session.app: @@ -529,18 +535,16 @@ def get_input( abs_read_only_fnames=None, edit_format=None, ): - self.rule() - # Ring the bell if needed self.ring_bell() rel_fnames = list(rel_fnames) - show = "" + show = self.rule() if rel_fnames: rel_read_only_fnames = [ get_rel_fname(fname, root) for fname in (abs_read_only_fnames or []) ] - show = self.format_files_for_input(rel_fnames, rel_read_only_fnames) + show += self.format_files_for_input(rel_fnames, rel_read_only_fnames) prompt_prefix = "" if edit_format: @@ -664,6 +668,7 @@ def get_continuation(width, line_number, is_soft_wrap): complete_while_typing=True, prompt_continuation=get_continuation, ) + self.display_user_input(show + line) else: line = input(show) @@ -765,8 +770,8 @@ def log_llm_history(self, role, content): self.llm_history_file = None def display_user_input(self, inp): - if self.pretty and self.user_input_color: - style = dict(style=self.user_input_color) + if self.pretty and self.user_submitted_input_color: + style = dict(style=self.user_submitted_input_color) else: style = dict() @@ -879,6 +884,7 @@ def is_valid_response(text): style=style, complete_while_typing=False, ) + self.display_user_input(question + res) else: res = input(question) except EOFError: diff --git a/aider/main.py b/aider/main.py index afb3f836624..fb5b25bfc3e 100644 --- a/aider/main.py +++ b/aider/main.py @@ -557,6 +557,7 @@ def get_io(pretty): input=input, output=output, user_input_color=args.user_input_color, + user_submitted_input_color=args.user_submitted_input_color, tool_output_color=args.tool_output_color, tool_warning_color=args.tool_warning_color, tool_error_color=args.tool_error_color, diff --git a/aider/website/docs/config/dotenv.md b/aider/website/docs/config/dotenv.md index 11681bf0722..67bc5d756b0 100644 --- a/aider/website/docs/config/dotenv.md +++ b/aider/website/docs/config/dotenv.md @@ -202,6 +202,9 @@ cog.outl("```") ## Set the color for user input (default: #00cc00) #AIDER_USER_INPUT_COLOR=#00cc00 +## Set the color for user submitted input (default: None) +#AIDER_USER_SUBMITTED_INPUT_COLOR= + ## Set the color for tool output (default: None) #AIDER_TOOL_OUTPUT_COLOR= From a27eab594ec6f2c4a6460b8a77b82d7f7c673d1c Mon Sep 17 00:00:00 2001 From: Matteo Landi Date: Sun, 18 May 2025 15:40:55 +0200 Subject: [PATCH 2/6] Add new setting to yaml --- aider/website/assets/sample.aider.conf.yml | 3 +++ aider/website/docs/config/options.md | 12 ++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/aider/website/assets/sample.aider.conf.yml b/aider/website/assets/sample.aider.conf.yml index f79b13dfb08..6170a5a8c42 100644 --- a/aider/website/assets/sample.aider.conf.yml +++ b/aider/website/assets/sample.aider.conf.yml @@ -173,6 +173,9 @@ ## Set the color for user input (default: #00cc00) #user-input-color: "#00cc00" +## Set the color for user submitted input (default: None) +#user-submitted-input-color: "#00cc00" + ## Set the color for tool output (default: None) #tool-output-color: "xxx" diff --git a/aider/website/docs/config/options.md b/aider/website/docs/config/options.md index c974f671b72..eeb2a6253d5 100644 --- a/aider/website/docs/config/options.md +++ b/aider/website/docs/config/options.md @@ -42,10 +42,10 @@ usage: aider [-h] [--model] [--openai-api-key] [--anthropic-api-key] [--restore-chat-history | --no-restore-chat-history] [--llm-history-file] [--dark-mode] [--light-mode] [--pretty | --no-pretty] [--stream | --no-stream] - [--user-input-color] [--tool-output-color] - [--tool-error-color] [--tool-warning-color] - [--assistant-output-color] [--completion-menu-color] - [--completion-menu-bg-color] + [--user-input-color] [--user-submitted-input-color] + [--tool-output-color] [--tool-error-color] + [--tool-warning-color] [--assistant-output-color] + [--completion-menu-color] [--completion-menu-bg-color] [--completion-menu-current-color] [--completion-menu-current-bg-color] [--code-theme] [--show-diffs] [--git | --no-git] @@ -329,6 +329,10 @@ Set the color for user input (default: #00cc00) Default: #00cc00 Environment variable: `AIDER_USER_INPUT_COLOR` +### `--user-submitted-input-color VALUE` +Set the color for user submitted input (default: #00cc00) +Environment variable: `AIDER_USER_SUBMITTED_INPUT_COLOR` + ### `--tool-output-color VALUE` Set the color for tool output (default: None) Environment variable: `AIDER_TOOL_OUTPUT_COLOR` From 04925d900d14c0d375d6102df2a7057fefb12172 Mon Sep 17 00:00:00 2001 From: "Matteo Landi (aider)" Date: Sun, 18 May 2025 16:19:11 +0200 Subject: [PATCH 3/6] refactor: Rename user submitted input color option --- aider/website/docs/config/options.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aider/website/docs/config/options.md b/aider/website/docs/config/options.md index eeb2a6253d5..942e5c1a2fc 100644 --- a/aider/website/docs/config/options.md +++ b/aider/website/docs/config/options.md @@ -42,7 +42,7 @@ usage: aider [-h] [--model] [--openai-api-key] [--anthropic-api-key] [--restore-chat-history | --no-restore-chat-history] [--llm-history-file] [--dark-mode] [--light-mode] [--pretty | --no-pretty] [--stream | --no-stream] - [--user-input-color] [--user-submitted-input-color] + [--user-input-color] [--user-input-submitted-color] [--tool-output-color] [--tool-error-color] [--tool-warning-color] [--assistant-output-color] [--completion-menu-color] [--completion-menu-bg-color] @@ -329,9 +329,9 @@ Set the color for user input (default: #00cc00) Default: #00cc00 Environment variable: `AIDER_USER_INPUT_COLOR` -### `--user-submitted-input-color VALUE` +### `--user-input-submitted-color VALUE` Set the color for user submitted input (default: #00cc00) -Environment variable: `AIDER_USER_SUBMITTED_INPUT_COLOR` +Environment variable: `AIDER_USER_INPUT_SUBMITTED_COLOR` ### `--tool-output-color VALUE` Set the color for tool output (default: None) From 617b038ebff0003c986ae65fe368cd867f1a0b30 Mon Sep 17 00:00:00 2001 From: "Matteo Landi (aider)" Date: Sun, 18 May 2025 16:23:11 +0200 Subject: [PATCH 4/6] refactor: Rename user-submitted-input-color to user-input-submitted-color --- aider/args.py | 2 +- aider/io.py | 12 ++++++------ aider/main.py | 2 +- aider/website/assets/sample.aider.conf.yml | 4 ++-- aider/website/docs/config/dotenv.md | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/aider/args.py b/aider/args.py index 667d6557309..7c84c6a3b12 100644 --- a/aider/args.py +++ b/aider/args.py @@ -331,7 +331,7 @@ def get_parser(default_config_files, git_root): help="Set the color for user input (default: #00cc00)", ) group.add_argument( - "--user-submitted-input-color", + "--user-input-submitted-color", default=None, help="Set the color for user submitted input (default: #00cc00)", ) diff --git a/aider/io.py b/aider/io.py index 02bda52bb9b..8a5f0c18968 100644 --- a/aider/io.py +++ b/aider/io.py @@ -243,7 +243,7 @@ def __init__( input=None, output=None, user_input_color="blue", - user_submitted_input_color=None, + user_input_submitted_color=None, tool_output_color=None, tool_error_color="red", tool_warning_color="#FFA500", @@ -282,8 +282,8 @@ def __init__( pretty = False self.user_input_color = ensure_hash_prefix(user_input_color) if pretty else None - self.user_submitted_input_color = ( - ensure_hash_prefix(user_submitted_input_color) if pretty else None + self.user_input_submitted_color = ( + ensure_hash_prefix(user_input_submitted_color) if pretty else None ) self.tool_output_color = ensure_hash_prefix(tool_output_color) if pretty else None self.tool_error_color = ensure_hash_prefix(tool_error_color) if pretty else None @@ -380,7 +380,7 @@ def _validate_color_settings(self): """Validate configured color strings and reset invalid ones.""" color_attributes = [ "user_input_color", - "user_submitted_input_color", + "user_input_submitted_color", "tool_output_color", "tool_error_color", "tool_warning_color", @@ -770,8 +770,8 @@ def log_llm_history(self, role, content): self.llm_history_file = None def display_user_input(self, inp): - if self.pretty and self.user_submitted_input_color: - style = dict(style=self.user_submitted_input_color) + if self.pretty and self.user_input_submitted_color: + style = dict(style=self.user_input_submitted_color) else: style = dict() diff --git a/aider/main.py b/aider/main.py index fb5b25bfc3e..ca93a144229 100644 --- a/aider/main.py +++ b/aider/main.py @@ -557,7 +557,7 @@ def get_io(pretty): input=input, output=output, user_input_color=args.user_input_color, - user_submitted_input_color=args.user_submitted_input_color, + user_input_submitted_color=args.user_input_submitted_color, tool_output_color=args.tool_output_color, tool_warning_color=args.tool_warning_color, tool_error_color=args.tool_error_color, diff --git a/aider/website/assets/sample.aider.conf.yml b/aider/website/assets/sample.aider.conf.yml index 6170a5a8c42..cf208ff7a48 100644 --- a/aider/website/assets/sample.aider.conf.yml +++ b/aider/website/assets/sample.aider.conf.yml @@ -173,8 +173,8 @@ ## Set the color for user input (default: #00cc00) #user-input-color: "#00cc00" -## Set the color for user submitted input (default: None) -#user-submitted-input-color: "#00cc00" +## Set the color for user submitted input (default: #00cc00) +#user-input-submitted-color: "#00cc00" ## Set the color for tool output (default: None) #tool-output-color: "xxx" diff --git a/aider/website/docs/config/dotenv.md b/aider/website/docs/config/dotenv.md index 67bc5d756b0..4e5a7253ae2 100644 --- a/aider/website/docs/config/dotenv.md +++ b/aider/website/docs/config/dotenv.md @@ -202,8 +202,8 @@ cog.outl("```") ## Set the color for user input (default: #00cc00) #AIDER_USER_INPUT_COLOR=#00cc00 -## Set the color for user submitted input (default: None) -#AIDER_USER_SUBMITTED_INPUT_COLOR= +## Set the color for user submitted input (default: #00cc00) +#AIDER_USER_INPUT_SUBMITTED_COLOR= ## Set the color for tool output (default: None) #AIDER_TOOL_OUTPUT_COLOR= From 9b8da6a812c7fd96472f3cf9dc5ff2b00b09aa1a Mon Sep 17 00:00:00 2001 From: Matteo Landi Date: Mon, 19 May 2025 09:42:45 +0200 Subject: [PATCH 5/6] Update new setting default value --- aider/website/assets/sample.aider.conf.yml | 4 ++-- aider/website/docs/config/options.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/aider/website/assets/sample.aider.conf.yml b/aider/website/assets/sample.aider.conf.yml index cf208ff7a48..904dd9a7d9a 100644 --- a/aider/website/assets/sample.aider.conf.yml +++ b/aider/website/assets/sample.aider.conf.yml @@ -173,8 +173,8 @@ ## Set the color for user input (default: #00cc00) #user-input-color: "#00cc00" -## Set the color for user submitted input (default: #00cc00) -#user-input-submitted-color: "#00cc00" +## Set the color for user submitted input (default: None) +#user-input-submitted-color: "xxx" ## Set the color for tool output (default: None) #tool-output-color: "xxx" diff --git a/aider/website/docs/config/options.md b/aider/website/docs/config/options.md index 942e5c1a2fc..0ac289b688b 100644 --- a/aider/website/docs/config/options.md +++ b/aider/website/docs/config/options.md @@ -330,7 +330,7 @@ Default: #00cc00 Environment variable: `AIDER_USER_INPUT_COLOR` ### `--user-input-submitted-color VALUE` -Set the color for user submitted input (default: #00cc00) +Set the color for user submitted input (default: None) Environment variable: `AIDER_USER_INPUT_SUBMITTED_COLOR` ### `--tool-output-color VALUE` From e279114a78fcbde408fe2a572c3aa98e036f2f58 Mon Sep 17 00:00:00 2001 From: Matteo Landi Date: Tue, 20 May 2025 11:28:27 +0200 Subject: [PATCH 6/6] Remove contintuation prompt We are not able to easily replicate it after the introduction of a new highlight for the submitted user input, so we might as well remove it altogether. --- aider/io.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/aider/io.py b/aider/io.py index 8a5f0c18968..24e20666b2e 100644 --- a/aider/io.py +++ b/aider/io.py @@ -654,9 +654,6 @@ def _(event): if self.clipboard_watcher: self.clipboard_watcher.start() - def get_continuation(width, line_number, is_soft_wrap): - return self.prompt_prefix - line = self.prompt_session.prompt( show, default=default, @@ -666,7 +663,6 @@ def get_continuation(width, line_number, is_soft_wrap): style=style, key_bindings=kb, complete_while_typing=True, - prompt_continuation=get_continuation, ) self.display_user_input(show + line) else: