chiark / gitweb /
^L to refresh the screen.
authorSimon Tatham <anakin@pobox.com>
Sun, 7 Jan 2024 07:30:45 +0000 (07:30 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 7 Jan 2024 07:30:45 +0000 (07:30 +0000)
In case of corruption. An obvious case of corruption is extraneous
output to the same tty (from an unrelated background process, or from
a rogue dbg! in this program itself). Another one I've been seeing
recently is a mysterious corruption relating to some Unicode
characters that only shows up in tmux on one system. But regardless, I
want to get on with my session after anything like that happens.

src/tui.rs

index 70f39c50d34a553cf770c79b24e8504ff0a6a208..87ad0627b8001432d3bfe31879c4559020bb4f12 100644 (file)
@@ -140,6 +140,7 @@ enum SubthreadEvent {
 pub enum PhysicalAction {
     Nothing,
     Beep,
+    Refresh,
     Exit,
     Error(TuiError),
 }
@@ -393,6 +394,10 @@ impl Tui {
                                             break 'outer Ok(());
                                         }
 
+                                        PhysicalAction::Refresh => {
+                                            self.terminal.clear()?;
+                                        }
+
                                         PhysicalAction::Error(err) => {
                                             break 'outer Err(err);
                                         }
@@ -418,6 +423,10 @@ impl Tui {
                                     break 'outer Ok(());
                                 }
 
+                                PhysicalAction::Refresh => {
+                                    self.terminal.clear()?;
+                                }
+
                                 PhysicalAction::Error(err) => {
                                     break 'outer Err(err);
                                 }
@@ -592,6 +601,11 @@ impl TuiLogicalState {
             OurKey::Escape => LogicalAction::Goto(
                 UtilityActivity::UtilsMenu.into()),
 
+            // ^L forces a full screen redraw, in case your terminal
+            // was corrupted by extraneous output. And again it should
+            // do it absolutely anywhere.
+            OurKey::Ctrl('L') => return PhysicalAction::Refresh,
+
             _ => if let Some(ref mut state) = self.overlay_activity_state {
                 state.handle_keypress(key, client)
             } else {