-
Notifications
You must be signed in to change notification settings - Fork 33
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
How about a selectrum-candidate-displayed instead of a suffix and prefix? #14
Comments
There is an explicit reason I don't allow users to fully customize the display appearance, which is that getting highlighting to work correctly in this case is much more difficult. If there is a prefix and suffix, then currently to highlight we simply highlight the raw candidate and then add the prefix and suffix. If all we get for display is an arbitrarily transformed candidate string, it's not clear how to highlight it correctly in general. I would be fine with adding a new text property that allows you to specify a string that is displayed at the right margin. This would not cause any of the above problems, and would solve your concern (plus would allow the width to be automatically recomputed when the frame is resized). |
I thought about this for a while. Maybe we can use lists for left/right margin properties, so we can have multiple things in both margins. You can have a look at ivy-rich. I bet in the future, someone will want to invent similar things with selectrum, or least have icons displayed at left margin (maybe using all-the-icons). If we use lists, they can just push whatever they want to them. |
I would be okay with there being one or more optional text properties that allow you to add extra information to be displayed in separate columns in either margin, as long as the user is responsible for providing maximum/minimum width information and relative priorities for the fields, so that the logic in Selectrum remains simple. |
I'll close this since #44 is merged. If in the future we need a more sophisticated solution (like using lists for prefix and right margin text), we could track it using a new issue. |
I'm working on a command that inserts a unicode character. It looks like this:
I'm not gonna use this layout because it looks bad when the width of my frame is not enough. But I discovered some problem when implementing it. I have to do something like this to make the display right:
which is not elegant. After looking into selectrum's code I found that the prefix and suffix is used only for build the displayed form. so how about using one
selectrum-candidate-displayed
instead, so I can just do:Also, the candidate itself may not appear in its original form in some commands (I don't have an example now). By doing this we also make these commands possible.
The text was updated successfully, but these errors were encountered: