I have been trying to implement a function with ivy
that needs to run a particular function not only on selection but also on every selection change in the list.
To be specific, when the user scrolls the list of available options, the currently selected item from the list should be identifiable.
(ivy-read "Choose: "
(list "one" "two" "three")
:action (lambda (n)
(do-something n))
:update-fn #'do-something-else)
The above code runs the lambda when a particular item (either one
, two
, or three
) is selected and the return key is pressed. Also, with the update-fn
in place, even typing one of the values does do-something-else
and I can read the value typed as ivy-text
. However, I need some action to be triggered when the user scrolls through the list of numbers without even typing.
Is that even possible?