Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ivy-next-history-element breaks future history when there's no symbol at point #3034

Open
catern opened this issue Feb 12, 2024 · 0 comments

Comments

@catern
Copy link

catern commented Feb 12, 2024

ivy-next-history-element (run by M-n) contains a condition which inserts the symbol at point if (and (= minibuffer-history-position 0) (equal ivy-text "")).

If there is a symbol at point, then subsequent M-ns will skip that conditional and insert the actual future history. (aka, the list of defaults in this minibuffer session)

However, if there's no symbol at point, the first M-n will insert nothing. Since it also doesn't update minibuffer-history-position, the conditional will be hit every time, and so future history will never be used.

The fix is to delete this conditional in ivy-next-history-element; it's not the correct way to add a default. Instead, a default should be added in the normal way, either by adding values to minibuffer-default or by using minibuffer-default-add-function.

An example of one function that's broken by this is project-find-file (bound by default to C-x p f). Future history contains the current file path, so M-n is supposed to insert that, but ivy breaks this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant