-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
Use line-prefix for embark-completing-read-prompter. #130
Conversation
Using line-prefix instead of display allows completion packages like selectrum to highlight the selected candidate and the current matching characters.
I don't use the completing-read prompter or Selectrum that often so I hadn't even noticed the problem. This does look nicer, thank you! |
My pleasure! Thanks for the quick merge :) |
Mmh, looks like I could go back to using display, but only on the first character (I'd love to use display on an empty string, but text properties need a character to go on). The first character still wouldn't get highlighted in Selectrum, but all the others would. Or, I could go nuclear, put the the display property on a zero width space or something like that, and then remove that zero width space in a bunch of places: OK, I probably won't do that last one. I think the realistic options are keep it as it is now, or go back to |
That's indeed some unfortunate surprise. I also thought at first that getting a transform would be the "ideal" way but soon realized it might be too much for this. Can we add a customizable predicate function here to decide which way to go? For example the users could check for minor modes and/or buffer names to decide whether they should use |
After a bit thinking it appears what I suggested probably would not work... However, looking at the problem, we are basically trying to do two things within one slot: 1) to inform the user of available action shortcuts, 2) to prompt for an action to perform. Would it be a good idea if we separate these? For example, if a user wants to know what commands are available, we can display a embark collect buffer or maybe something using which-key-mode. But when the user just wants to manually enter a command, we can then use competing read, whether selectrum or icomplete, without showing the shortcuts. In this way we can just use |
Well, I like having the key bindings shown in the completing-read prompter because you can use them: if you press But maybe the key bindings should just be in the annotation for the candidates, not in the candidates themselves. I'll try that to see how it feels. |
Yeah that makes sense. I also played with it a bit. We can add annotation or affixation functions as this, but marginalia would override our annotation or affixation functions. We would need to ask it to respect existing annotations, or add a different category in marginalia.
|
I decided to not leave (horizontal) Icomplete users out of the keybinding fun. This means going back to display, but now I put in on the last letter, which I think is less noticeable than putting it on the first letter. So Selectrum highlights everything but the last letter and the keybinding. This way looks fine in icomplete, icomplete-vertical, the Also I think it makes more sense to display the command name first and the key binding second, because presumably, if you've forgotten a keybinding, you visually scan for the command name first. See a4623c3 |
Thanks for letting me know! Yeah this probably is the best with not too many changes. |
I filed an issue about this: radian-software/selectrum#411. |
I forgot to mention the reason I decided against using the keybindings as annotations. It's because I don't want to loose whatever annotations the user usually has for commands. That's also why I don't make the candidates include an extra space, for example. |
Using line-prefix instead of display allows completion packages
like selectrum to highlight the selected candidate and the current
matching characters.