feat: full password editing with cursor navigation

- Add arrow key support (Left/Right/Home/End) for cursor movement
- Add Delete key to remove character at cursor position
- Render cursor between password dots with visual indicator
- Modularize render.rs into separate modules (indicator, media_bar, status_bar, feedback)
- Add cubic ease-in-out for fade-in animation
- Optimize media_rects to use &'static str instead of String allocations
This commit is contained in:
2026-04-11 15:43:11 +02:00
parent 05cf0c1d7e
commit 016038aca0
10 changed files with 1263 additions and 1309 deletions
+10 -1
View File
@@ -84,7 +84,14 @@ impl LockedSurface {
if self.fade_alpha < 1.0 {
let elapsed = self.start_time.elapsed();
let fade_duration = std::time::Duration::from_secs_f32(self.config.fade_in);
let new_alpha = (elapsed.as_secs_f64() / fade_duration.as_secs_f64()).min(1.0);
// Ease-in-out cubic function
let t = (elapsed.as_secs_f64() / fade_duration.as_secs_f64()).clamp(0.0, 1.0);
let eased_t = if t < 0.5 {
4.0 * t * t * t
} else {
1.0 - (-2.0 * t + 2.0).powi(3) / 2.0
};
let new_alpha = eased_t.min(1.0);
if (new_alpha - self.fade_alpha).abs() > 0.001 {
self.fade_alpha = new_alpha;
self.renderer.set_fade_alpha(self.fade_alpha);
@@ -121,6 +128,8 @@ impl LockedSurface {
self.renderer
.set_password_display(self.input_handler.password_length());
self.renderer
.set_cursor_position(self.input_handler.cursor_position());
self.renderer.render();
}