From: Simon Tatham Date: Sun, 7 Jan 2024 07:30:45 +0000 (+0000) Subject: ^L to refresh the screen. X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=b94a9316cabe1c3fa43f3249af3fc22e07bd363a;p=mastodonochrome.git ^L to refresh the screen. 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. --- diff --git a/src/tui.rs b/src/tui.rs index 70f39c5..87ad062 100644 --- a/src/tui.rs +++ b/src/tui.rs @@ -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 {