diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/tui_backend.rs | 5 | ||||
-rw-r--r-- | src/ui/widgets/tui_textfield.rs | 10 |
2 files changed, 6 insertions, 9 deletions
diff --git a/src/ui/tui_backend.rs b/src/ui/tui_backend.rs index a7d7152..28103a3 100644 --- a/src/ui/tui_backend.rs +++ b/src/ui/tui_backend.rs @@ -14,7 +14,10 @@ pub struct TuiBackend { impl TuiBackend { pub fn new() -> std::io::Result<Self> { let stdout = std::io::stdout().into_raw_mode()?; - let alt_screen = AlternateScreen::from(stdout); + let mut alt_screen = AlternateScreen::from(stdout); + // clears the screen of artifacts + write!(alt_screen, "{}", termion::clear::All)?; + let backend = TermionBackend::new(alt_screen); let mut terminal = tui::Terminal::new(backend)?; terminal.hide_cursor()?; diff --git a/src/ui/widgets/tui_textfield.rs b/src/ui/widgets/tui_textfield.rs index b98a045..096e589 100644 --- a/src/ui/widgets/tui_textfield.rs +++ b/src/ui/widgets/tui_textfield.rs @@ -73,11 +73,7 @@ impl<'a> TuiTextField<'a> { let mut completion_tracker: Option<CompletionTracker> = None; - let char_idx = self - ._prefix - .chars() - .map(|c| c.len_utf8()) - .sum(); + let char_idx = self._prefix.chars().map(|c| c.len_utf8()).sum(); line_buffer.insert_str(0, self._suffix); line_buffer.insert_str(0, self._prefix); @@ -124,9 +120,7 @@ impl<'a> TuiTextField<'a> { let prefix = &line_buffer.as_str()[..cursor_xpos]; - let curr = line_buffer.as_str()[cursor_xpos..] - .chars() - .nth(0); + let curr = line_buffer.as_str()[cursor_xpos..].chars().nth(0); let (suffix, curr) = match curr { Some(c) => { let curr_len = c.len_utf8(); |