aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2019-11-08 12:05:45 -0500
committerJesse Luehrs <doy@tozt.net>2019-11-08 12:06:27 -0500
commit28aff72c64033c8e8ee86f95175a99e0d07b2478 (patch)
tree71974dc92d8fe4fd3a3ffe153e1c158ec5c368e6
parentaefa8ebabf109f6f65247ed341c15170810c830b (diff)
downloadteleterm-28aff72c64033c8e8ee86f95175a99e0d07b2478.tar.gz
teleterm-28aff72c64033c8e8ee86f95175a99e0d07b2478.zip
allow hiding the `tt play` pause ui
-rw-r--r--CHANGELOG.md4
-rw-r--r--src/cmd/play.rs23
2 files changed, 22 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c016c41..43287f9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,10 @@
## Unreleased
+### Added
+
+* `tt play` now supports hiding the pause ui.
+
### Fixed
* Bump `vt100` dep to fix a bunch of parsing bugs.
diff --git a/src/cmd/play.rs b/src/cmd/play.rs
index ebf1d2b..cb93784 100644
--- a/src/cmd/play.rs
+++ b/src/cmd/play.rs
@@ -430,6 +430,7 @@ struct PlaySession {
last_frame_time: std::time::Duration,
last_frame_screen: Option<vt100::Screen>,
input_state: InputState,
+ hide_ui: bool,
}
impl PlaySession {
@@ -454,6 +455,7 @@ impl PlaySession {
last_frame_time: std::time::Duration::default(),
last_frame_screen: None,
input_state: InputState::Normal,
+ hide_ui: false,
}
}
@@ -471,6 +473,13 @@ impl PlaySession {
self.player.toggle_pause();
}
crossterm::input::InputEvent::Keyboard(
+ crossterm::input::KeyEvent::Backspace,
+ ) => {
+ if self.player.paused() {
+ self.hide_ui = !self.hide_ui;
+ }
+ }
+ crossterm::input::InputEvent::Keyboard(
crossterm::input::KeyEvent::Char('+'),
) => {
self.player.playback_ratio_incr();
@@ -602,7 +611,7 @@ impl PlaySession {
fn draw_ui(&self) -> Result<()> {
let size = crate::term::Size::get()?;
- if self.player.paused() {
+ if self.player.paused() && !self.hide_ui {
self.write(b"\x1b7\x1b[37;44m\x1b[?25l")?;
self.draw_status()?;
@@ -641,25 +650,29 @@ impl PlaySession {
fn draw_help(&self, size: crate::term::Size) -> Result<()> {
self.write(
- format!("\x1b[{};{}H", size.rows - 11, size.cols - 32).as_bytes(),
+ format!("\x1b[{};{}H", size.rows - 12, size.cols - 32).as_bytes(),
)?;
self.write("╭".as_bytes())?;
self.write("─".repeat(30).as_bytes())?;
self.write("╮".as_bytes())?;
self.write(
- format!("\x1b[{};{}H", size.rows - 10, size.cols - 32).as_bytes(),
+ format!("\x1b[{};{}H", size.rows - 11, size.cols - 32).as_bytes(),
)?;
self.write("│ Keys │".as_bytes())?;
self.write(
- format!("\x1b[{};{}H", size.rows - 9, size.cols - 32).as_bytes(),
+ format!("\x1b[{};{}H", size.rows - 10, size.cols - 32).as_bytes(),
)?;
self.write("│ q: quit │".as_bytes())?;
self.write(
- format!("\x1b[{};{}H", size.rows - 8, size.cols - 32).as_bytes(),
+ format!("\x1b[{};{}H", size.rows - 9, size.cols - 32).as_bytes(),
)?;
self.write("│ Space: pause/unpause │".as_bytes())?;
self.write(
+ format!("\x1b[{};{}H", size.rows - 8, size.cols - 32).as_bytes(),
+ )?;
+ self.write("│ Backspace: hide/show ui │".as_bytes())?;
+ self.write(
format!("\x1b[{};{}H", size.rows - 7, size.cols - 32).as_bytes(),
)?;
self.write("│ </>: previous/next frame │".as_bytes())?;