branch: elpa/aidermacs commit 917a25405474b6fa0f5d563a6b374a517d5e7e17 Author: Kang Tu <kang...@apple.com> Commit: Kang Tu (aider) <kang...@apple.com>
feat: replace new-line characters with spaces in user input while preserving the final new-line in aider-read-string function --- aider.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/aider.el b/aider.el index 94ab272b97..2eafbacaea 100644 --- a/aider.el +++ b/aider.el @@ -26,7 +26,11 @@ (defun aider-read-string (prompt &optional initial-input) "Read a string from the user with PROMPT and optional INITIAL-INPUT. This function can be customized or redefined by the user." - (read-string prompt initial-input)) + (let ((input (read-string prompt initial-input))) + (setq input (replace-regexp-in-string "\n" " " input)) ;; Replace newlines with spaces + (if (string-suffix-p "\n" initial-input) + (concat input "\n") ;; Keep the final newline if it was present + input))) ;; Transient menu for Aider commands (transient-define-prefix aider-transient-menu ()