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

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

-rw-r--r-- src/ui/input.rs 19
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/src/ui/input.rs b/src/ui/input.rs
index ddd9f66..9c64ee9 100644
--- a/src/ui/input.rs
+++ b/src/ui/input.rs
@@ -1,13 +1,9 @@
#[derive(Debug, Clone, PartialEq)]
pub enum InputMode {
    Normal,
    Editing,
}

#[derive(Debug, Clone)]
pub struct Input {
    pub mode: InputMode,
    /// Input value
    pub value: String,
    pub hidden_password: bool,
    /// Hide the value in asterisk
    pub hidden: bool,
    /// Cursor postion x.
    pub cx: usize,
}
@@ -15,9 +11,8 @@
impl Input {
    pub fn new() -> Self {
        Self {
            mode: InputMode::Normal,
            value: String::new(),
            hidden_password: true,
            hidden: true,
            cx: 0,
        }
    }
@@ -73,9 +68,5 @@

    fn clamp_cursor(&self, new_cursor_pos: usize) -> usize {
        new_cursor_pos.clamp(0, self.value.chars().count())
    }

    pub const fn reset_cursor(&mut self) {
        self.cx = 0;
    }
}