]> git.eshelyaron.com Git - emacs.git/commitdiff
Make sure Comint minibuffer password prompts end with space main
authorRudolf Adamkovič <rudolf@adamkovic.org>
Fri, 28 Feb 2025 13:54:14 +0000 (14:54 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sun, 9 Mar 2025 10:35:00 +0000 (11:35 +0100)
* lisp/comint.el (comint-watch-for-password-prompt): Add a trailing
space character to the minibuffer password prompt, if it does not
contain one already, per the minibuffer UI conventions.

Bug#76604

(cherry picked from commit 41c1c6ffac3bc3db9818ed8e0cc857c72b06d806)

lisp/comint.el

index 4d60849c248b3c824c4208af8fb4e2593446fd30..0b434462ffc22d470ed2434b479cadabc5708152 100644 (file)
@@ -2593,8 +2593,14 @@ This function could be in the list `comint-output-filter-functions'."
         prompt)
     (when (let ((case-fold-search t))
             (string-match comint-password-prompt-regexp string))
-      (setq prompt (string-trim (match-string 0 string)
-                                "[ \n\r\t\v\f\b\a]+" "\n+"))
+      (setq prompt
+            (let ((content (string-trim (match-string 0 string)
+                                        "[ \n\r\t\v\f\b\a]+" "\n+"))
+                  (suffix " "))
+              (concat content
+                      (and (not (string-empty-p content))
+                           (not (string-suffix-p suffix content))
+                           suffix))))
       ;; Use `run-at-time' in order not to pause execution of the
       ;; process filter with a minibuffer
       (run-at-time