Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Off-by-one in counsel-yank-pop selection #1371
If I understand the recent changes correctly, the current kill-ring-yank-pointer position should be preselected. This seems to always be one off. If I have three lines which I've killed in order:
After killing "one", the counsel-yank-pop shows "one" and it is preselected.
After killing "three":
When I use the "rotate" command to change the current kill-ring-yank-pointer, it never sets the selection to the item selected, but is always one off. If I select "three", and use rotate (M-o r) to set the pointer, the next counsel-yank-pop shows "two" selected. If I select "two" and rotate, the next counsel-yank-pop shows "one" selected. If I select "one", the next invocation shows "three" selected.
For this issue I was using commit 5c096a2.
Preselecting the next-to-last kill is intended.
The recent changes to
The optional prefix argument defaults to 1, meaning yank the next-to-last kill. If you want to yank the last kill, you should pass it a prefix argument of zero.
The current implementation of
@basil-conto Thanks for the explanation. It makes sense in a way.
Yet in another way it doesn't. Using M-y RET instead of C-y seems like a nice use case. Of course, if you did M-w seconds ago, you know what's on the top of the kill ring and you can do C-y directly. But if you're just fairly sure that the thing you want is on the top of the kill ring, M-y RET gives you a preview, an option to back out with C-g, and an option to select something else.
Currently, the above use case was moved to the M-y C-p RET binding. I'm not sure it's worth the consistency with the defaults.
If you'll pardon the facetious retort, it doesn't make sense to discuss whether this makes sense. :)
Here's my understanding of why that is. Please to confirm/comment.
My conclusion is that, as is always the case, different people have different preferences, so we should simply do the Emacs-y and Counsel-y thing and add another user toggle which defaults to the old, non-Emacs behaviour, right?