Skip to content

Commit

Permalink
fix(component): rename Refresh action to ClearScreen, add handler, up…
Browse files Browse the repository at this point in the history
…date tui restore logic after suspend (#61)

Signed-off-by: Deep Panchal <[email protected]>
  • Loading branch information
deepanchal authored Jul 2, 2024
1 parent 678bce1 commit 5e823ef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion component/template/src/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub enum Action {
Suspend,
Resume,
Quit,
Refresh,
ClearScreen,
Error(String),
Help,
}
3 changes: 2 additions & 1 deletion component/template/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ impl App {
Action::Quit => self.should_quit = true,
Action::Suspend => self.should_suspend = true,
Action::Resume => self.should_suspend = false,
Action::ClearScreen => tui.terminal.clear()?,
Action::Resize(w, h) => {
tui.resize(Rect::new(0, 0, w, h))?;
tui.draw(|f| {
Expand Down Expand Up @@ -137,7 +138,7 @@ impl App {
if self.should_suspend {
tui.suspend()?;
action_tx.send(Action::Resume)?;
tui = tui::Tui::new()?.tick_rate(self.tick_rate).frame_rate(self.frame_rate);
action_tx.send(Action::ClearScreen)?;
// tui.mouse(true);
tui.enter()?;
} else if self.should_quit {
Expand Down

0 comments on commit 5e823ef

Please sign in to comment.