Implement password masking#657
Conversation
Signed-off-by: Nico Burns <nico@nicoburns.com>
| if self.password { | ||
| // Mask the entire text with the bullet character. Pushed last so it overrides any | ||
| // grapheme replacement that may have been set on the default styles. | ||
| builder.push_default(StyleProperty::GraphemeReplacement(Some('\u{2022}'))); |
There was a problem hiding this comment.
We do something similar in Slint and what we've observed is that sometimes that character isn't present on folks systems (yes, reality is sad :). It might make sense to just build the API around password replacement characters and then have a fallback to * inside parley, let the GraphemeReplacement bit an array of options, or ignore the problem :)
(thanks for bringing this into parley proper, btw!)
There was a problem hiding this comment.
Hmm... I wonder if a better option would be to allow the user to override the font. In Blitz we're bundling moz-bullet-font.otf that we got from Mozilla/Firefox which we also use for list item bullets. It's ~5kb (not entirely sure why it's so big - maybe just required metadata?).
|
I think the replacement may need to go slightly earlier in the pipeline so that it occurs before font-fallback (but still after shaping) and we can fallback with the replaced glyph instead of the original glyph. Otherwise you can get issues (invisible glyphs) in cases such as emoji where the font that matches for the original glyph doesn't have a glyph for the replacement glyph. |
Implements password masking in the Parley.
Generated with Opus 4.8 High. Reviewed manually. PR description hand written.
Builds on design work and discussion from #394
Changes made:
grapheme_replacement: Option<char>style (usingcharmakes this not fully general, but it works for the common case and keeps things simple)grapheme_replacementis Some)password: boolfield toPlainEditor(+getter/setter methods) that uses this functionality with the bullet character.Notes
Tested with Blitz
Screen.Recording.2026-06-28.at.21.01.09.mov