index : nmrs-tui
A fast, Vim-friendly NetworkManager TUI built in Rust.
about summary refs log tree commit diff

Diffstat (limited to 'src/ui/popup.rs')

-rw-r--r-- src/ui/popup.rs 8
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/ui/popup.rs b/src/ui/popup.rs
index d47d2a7..2261a8e 100644
--- a/src/ui/popup.rs
+++ b/src/ui/popup.rs
@@ -65,11 +65,17 @@
    ])
    .split(input_area);

    let (password, icon): (String, &'static str) = if input.hidden_password {
    let (mut password, icon): (String, &'static str) = if input.hidden_password {
        (input.value.chars().map(|_| '*').collect(), " 󰈉  ")
    } else {
        (input.value.to_string(), " 󰈈   ")
    };

    // Horizontal scrolling when password is to long
    let string_offset = password.len().saturating_sub(input_chunks[0].width.saturating_sub(1) as usize);
    if string_offset > 0 {
        password = password.split_at(string_offset).1.to_string();
    }

    let password_widget = Paragraph::new(password).style(Style::new().on_dark_gray());
    f.render_widget(password_widget, input_chunks[0]);