feat: obscure input component for inputting passwords#2675
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements an obscure input component for password entry by introducing an “obscure” flag that toggles between showing the real value and an obscured version. Key changes include updating rendering logic in the Input widget, modifying the data models (InputSnap, InputSnaps, Input) and their constructors to support the new flag, and propagating the flag through configuration and adapter layers.
Reviewed Changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| yazi-widgets/src/input/widget.rs | Updated widget render to call display() for obscured input display. |
| yazi-widgets/src/input/snaps.rs | Modified InputSnaps constructors to include the additional obscure flag. |
| yazi-widgets/src/input/snap.rs | Updated InputSnap to track the obscure flag and adjusted offset logic. |
| yazi-widgets/src/input/input.rs | Added an obscure field and updated display() and cursor calculations. |
| yazi-widgets/src/input/commands/move_.rs | Adjusted move logic to consider the obscure masking during calculations. |
| yazi-plugin/src/utils/layer.rs | Propagated the obscure flag from configuration to UI layer elements. |
| yazi-core/src/mgr/tabs.rs & mgr.rs | Removed obsolete active_or functions in favor of cleaner API calls. |
| yazi-core/src/input/input.rs & commands/show.rs | Updated Input instantiation to include the obscure flag from config. |
| yazi-config/src/popup/options.rs | Added the obscure flag to InputCfg and removed the highlight option. |
| yazi-adapter/src/brand.rs | Added a vendor mapping for Warp alongside the other brand key mappings. |
Files not reviewed (1)
- yazi-plugin/preset/plugins/extract.lua: Language not supported
Comments suppressed due to low confidence (3)
yazi-adapter/src/brand.rs:56
- [nitpick] Ensure the key 'WARP_HONOR_PS1' is correct and consistent with vendor detection naming conventions.
("WARP_HONOR_PS1", B::Warp),
yazi-widgets/src/input/snap.rs:30
- Initializing 'offset' to 0 instead of usize::MAX changes the starting window calculation; please double-check that this change correctly handles cases when no input has been made yet.
offset: 0,
yazi-widgets/src/input/input.rs:78
- Verify that the display() method correctly updates the rendered value when the obscure flag is toggled, ensuring consistent behavior with the intended UI design.
pub fn display(&self) -> Cow<str> {
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An implementation of the feature request: #2671
Closes #2671
With this PR, a new
obscure = trueoption is available: