Repository: atuinsh/atuin (language: rust)

Issue:
redraw the UI
Sometimes the terminal text is messed up, e.g. by a background process. It's expected that a `Ctrl-L` to redraw the UI. However, it seems that `Ctrl-L` is already used by other functionality.


Discussion / hints:

Fix patch:
diff --git a/atuin/src/command/client/search/interactive.rs b/atuin/src/command/client/search/interactive.rs
index 14b80f786bd..a6275aac23d 100644
--- a/atuin/src/command/client/search/interactive.rs
+++ b/atuin/src/command/client/search/interactive.rs
@@ -44,6 +44,7 @@ enum InputAction {
     ReturnOriginal,
     ReturnQuery,
     Continue,
+    Redraw,
 }
 
 #[allow(clippy::struct_field_names)]
@@ -169,9 +170,6 @@ impl State {
             KeyCode::Left => {
                 self.search.input.left();
             }
-            KeyCode::Char('h') if ctrl => {
-                self.search.input.left();
-            }
             KeyCode::Char('b') if ctrl => {
                 self.search.input.left();
             }
@@ -184,7 +182,6 @@ impl State {
                 .input
                 .next_word(&settings.word_chars, settings.word_jump_mode),
             KeyCode::Right => self.search.input.right(),
-            KeyCode::Char('l') if ctrl => self.search.input.right(),
             KeyCode::Char('f') if ctrl => self.search.input.right(),
             KeyCode::Char('a') if ctrl => self.search.input.start(),
             KeyCode::Home => self.search.input.start(),
@@ -286,6 +283,9 @@ impl State {
             KeyCode::Char('p' | 'k') if ctrl && settings.invert => {
                 self.scroll_down(1);
             }
+            KeyCode::Char('l') if ctrl => {
+                return InputAction::Redraw;
+            }
             KeyCode::Char(c) => self.search.input.insert(c),
             KeyCode::PageDown if !settings.invert => {
                 let scroll_len = self.results_state.max_entries() - settings.scroll_context_lines;
@@ -693,6 +693,10 @@ pub async fn history(
                     loop {
                         match app.handle_input(settings, &event::read()?, &mut std::io::stdout())? {
                             InputAction::Continue => {},
+                            InputAction::Redraw => {
+                                terminal.clear()?;
+                                terminal.draw(|f| app.draw(f, &results, settings))?;
+                            },
                             r => {
                                 accept = app.accept;
                                 break 'render r;
@@ -743,7 +747,7 @@ pub async fn history(
             // * out of bounds -> usually implies no selected entry so we return the input
             Ok(app.search.input.into_inner())
         }
-        InputAction::Continue => {
+        InputAction::Continue | InputAction::Redraw => {
             unreachable!("should have been handled!")
         }
     }


Test patch: