Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Selection of first match after changes to the input doesn't always work #253
After 126158d, the first match should be selected after the input has changed with the exception of swiper. It works in the case I constructed in #231 but not always. Here's a test case which currently fails:
Here I'd expect the first item "aba" to be selected because the first matching element should be selected after changes to the input. What's actually selected is "baa" which is neither the first match nor the last match so completely implausible. So that's a bug but I also have two other points.
What would you propose doing if the previously selected candidate no longer matched the new input? Something like:
(should (equal (ivy-with '(ivy-read "pattern: " '("aba" "baa" "abc")) "a C-n C-n b C-m ") "???")) ;; What should this be?
I'd like try to avoid this approach in the future. It removes the flexibility of user commands calling ivy functions, and also
(ivy-read "Swiper: " candidates :initial-input initial-input :keymap swiper-map :preselect preselect :require-match t :update-fn #'swiper--update-input-ivy :unwind #'swiper--cleanup :re-builder #'swiper--re-builder :history 'swiper-history :caller 'swiper)
This would mean that each
Yes, I've also thought about extending the ivy state with a field for the caller, so we may assume that if two people think the same individually, it can't be too wrong.
BTW right now, the
I think, the new
However, dispatching on