From 79246575844c6e545c7c1936e7ef12445e692a23 Mon Sep 17 00:00:00 2001 From: "Matteo Landi (aider)" Date: Thu, 27 Mar 2025 10:35:03 +0100 Subject: [PATCH] feat: Improve C-x C-e editor keybinding to handle cursor and newline --- aider/io.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/aider/io.py b/aider/io.py index d4d8205af..053f739db 100644 --- a/aider/io.py +++ b/aider/io.py @@ -567,8 +567,11 @@ class InputOutput: # Open the editor with the current text edited_text = pipe_editor(input_data=current_text) - # Replace the buffer with the edited text - buffer.text = edited_text + # Replace the buffer with the edited text, strip any trailing newlines + buffer.text = edited_text.rstrip('\n') + + # Move cursor to the end of the text + buffer.cursor_position = len(buffer.text) @kb.add("enter", eager=True, filter=~is_searching) def _(event):