Parcourir la source

Fix edge case in ido-select-text require-match fix

It turns out that if require-match is non-nil AND a default is provided,
then "completing-read-default" cannot return an empty string. This
commit matches this behavior on ido-completing-read+.
Ryan C. Thompson il y a 9 ans
Parent
commit
3eccab544f
1 fichiers modifiés avec 6 ajouts et 4 suppressions
  1. 6 4
      ido-completing-read+.el

+ 6 - 4
ido-completing-read+.el

@@ -288,12 +288,14 @@ match is equivalent to TAB, and C-j selects the first match.
 Since RET in ido already selects the first match, this advice
 sets up C-j to be equivalent to TAB in the same situation."
   (if (and
-       ;; Only if using ico-cr+
+       ;; Only override C-j behavior if...
+       ;; We're using ico-cr+
        ido-cr+-enable-this-call
-       ;; Only if require-match is non-nil
+       ;; Require-match is non-nil
        (with-no-warnings ido-require-match)
-       ;; Only if current text is non-empty
-       (not (string= ido-text ""))
+       ;; A default was provided, or ido-text is non-empty
+       (or ido-default-item
+           (not (string= ido-text "")))
        ;; Only if current text is not a complete choice
        (not (member ido-text (with-no-warnings ido-cur-list))))
       (progn