(should (equal
(ivy-with '(ivy-read "pattern: " '("blue" "yellow"))
"z C-m")
- "z")))
+ "z"))
+ (should (equal
+ (ivy-with '(ivy-read "pattern: " '("blue" "yellow"))
+ "y <backspace> C-m")
+ "blue"))
+ (should (equal
+ (ivy-with '(let ((ivy-re-builders-alist '((t . ivy--regex-fuzzy))))
+ (ivy-read "pattern: " '("package-list-packages" "something-else")))
+ "plp C-m")
+ "package-list-packages")))
(ert-deftest swiper--re-builder ()
(setq swiper--width 4)
res))))
(tail (nthcdr ivy--index ivy--old-cands))
idx)
- (when (and tail ivy--old-cands (not (equal "^" ivy--old-re)))
- (unless (and (not (equal re-str ivy--old-re))
- (or (setq ivy--index
- (or
- (cl-position (if (and (> (length re-str) 0)
- (eq ?^ (aref re-str 0)))
- (substring re-str 1)
- re-str) cands
- :test #'equal)
- (and ivy--directory
- (cl-position
- (concat re-str "/") cands
- :test #'equal))))))
- (while (and tail (null idx))
- ;; Compare with eq to handle equal duplicates in cands
- (setq idx (cl-position (pop tail) cands)))
- (setq ivy--index (or idx 0))))
+ (if (eq (ivy-state-unwind ivy-last) 'swiper--cleanup)
+ (when (and tail ivy--old-cands (not (equal "^" ivy--old-re)))
+ (unless (and (not (equal re-str ivy--old-re))
+ (or (setq ivy--index
+ (or
+ (cl-position (if (and (> (length re-str) 0)
+ (eq ?^ (aref re-str 0)))
+ (substring re-str 1)
+ re-str) cands
+ :test #'equal)
+ (and ivy--directory
+ (cl-position
+ (concat re-str "/") cands
+ :test #'equal))))))
+ (while (and tail (null idx))
+ ;; Compare with eq to handle equal duplicates in cands
+ (setq idx (cl-position (pop tail) cands)))
+ (setq ivy--index (or idx 0))))
+ (setq ivy-index 0))
(when (and (string= name "") (not (equal ivy--old-re "")))
(setq ivy--index
(or (cl-position (ivy-state-preselect ivy-last)