chiark / gitweb /
Add SingleLineEditor feature to mask passwords.
authorSimon Tatham <anakin@pobox.com>
Sat, 20 Jan 2024 10:22:09 +0000 (10:22 +0000)
committerSimon Tatham <anakin@pobox.com>
Sat, 20 Jan 2024 10:59:54 +0000 (10:59 +0000)
commit8cf2c7b36bbca81057bf80b34c032f41c57c8aac
treef5d8885d726fe068fb004815591e18ddd24d812a
parent8ebe8ac0c1c189f418a0d5a1ede9c8c838c2a9f3
Add SingleLineEditor feature to mask passwords.

The implementor of an EditableMenuLineData trait can now set the trait
constant SECRET to indicate that the editor should display the text
as ******* while editing. However, the trait is responsible for doing
the same masking itself when displaying the data in non-editing
mode.

(This division of labour is necessary so that display() can also apply
other display features, such as complaining that you haven't given a
password at all yet, or that they don't match. display() is the only
thing that can know _which_ of its output needs masking.)
src/editor.rs