-
Notifications
You must be signed in to change notification settings - Fork 45
Implement the ability to hide the editor text with a given repeated character #394
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
base: main
Are you sure you want to change the base?
Conversation
I see that EDIT: I figured out how to expand the command output in the Github CI and fixed the no_std issues. clippy still seems to complain locally, which is what led to the confusion. |
I'm also very keen to have this functionality, but I think we'll need more sophisticated logic to handle character counting (one |
Oh, that is right, I forgot about this entirely (it is sometimes too easy to forget). Thanks for the reminder. Would it be fine to use the unicode-segmentation crate to count the grapheme clusters? It is currently not a dependency and I am not sure how parley intends on doing Unicode segmentation (i.e., what dependency to use for that functionality). |
53143be
to
125440c
Compare
This is a desirable feature, but this is not the right design I think. Introducing more segmentation is not necessary if we use a style instead, for example; and it lets you set it up simply with a default style, or a range/tree style (and eventually, through Attributed Text). My suggestion is to address it through styles, call it grapheme replacement or cluster substitution or something, maybe make it use a &'static str (or a fixed length string type which reasonably accommodates values)... but there may be complications with that, which I have not thought of. |
10bc321
to
755da0b
Compare
755da0b
to
1571886
Compare
Thanks for the pointer, this makes a lot more sense and also seems to be a lot simpler. I added the I am currently using I also set Finally, I am also unsure about whether the output layout should still contain |
I am currently using a text input field in xilem as a password field, but there is currently no way to hide the text by replacing the actual buffer of characters with a repeated character such as an asterisk (i.e.,
'*'
). Further looking into xilem and masonry, I found that the text input field leveragesPlainEditor
in parley, so I am trying to extend that first.More specifically, this commit adds a
visible_buffer
field to hold the character buffer with the replaced characters and ahide_symbol
field to hold the character that needs to be shown (if any is set). This is to ensure that the originalbuffer
field stays intact everywhere else (together with the corresponding logic), and this seems to be the least intrusive way to achieve this. Further, I have extendedupdate_layout
to update thevisible_buffer
field if the symbol or the length of the original buffer changed and to decide which buffer needs to be shown based on whether the symbol is set or not. Finally, this adds two methods to set and clear the symbol used for hiding the text.Extending this functionality to masonry/xilem should be as simple as calling those two methods once this lands. I think this is also neat because this makes it simple to add a show/hide password checkbox if desired.
Issue #327 is related, but we should keep that open even if this lands, because there are probably a bunch of corner cases or additional desired features, I am just trying to get the most awkward part out of the way which is that the password shouldn't be visible on the screen.