Browse and listen to thousands of radio stations across the globe right from your terminal ๐ŸŒŽ ๐Ÿ“ป ๐ŸŽตโœจ
radio rust tokio web-radio command-line-tool tui

tui: enable KeyboardEnhancementFlags::DISAMBIGUATE_ESCAPE_CODES

This is so that media controls work when implemented.

Changed files
+18 -1
src
+18 -1
src/tui.rs
··· 1 1 use std::io::{self, stderr, stdout, Stdout}; 2 2 3 - use crossterm::{execute, terminal::*}; 3 + use crossterm::{ 4 + event::{KeyboardEnhancementFlags, PopKeyboardEnhancementFlags, PushKeyboardEnhancementFlags}, 5 + execute, 6 + terminal::*, 7 + }; 4 8 use ratatui::prelude::*; 5 9 6 10 /// A type alias for the terminal type used in this application ··· 10 14 pub fn init() -> io::Result<Tui> { 11 15 execute!(stdout(), EnterAlternateScreen)?; 12 16 execute!(stderr(), EnterAlternateScreen)?; 17 + if let Ok(true) = crossterm::terminal::supports_keyboard_enhancement() { 18 + execute!( 19 + stdout(), 20 + PushKeyboardEnhancementFlags(KeyboardEnhancementFlags::DISAMBIGUATE_ESCAPE_CODES) 21 + )?; 22 + } 23 + 13 24 enable_raw_mode()?; 25 + 14 26 Terminal::new(CrosstermBackend::new(stdout())) 15 27 } 16 28 ··· 18 30 pub fn restore() -> io::Result<()> { 19 31 execute!(stdout(), LeaveAlternateScreen)?; 20 32 execute!(stderr(), LeaveAlternateScreen)?; 33 + if let Ok(true) = crossterm::terminal::supports_keyboard_enhancement() { 34 + execute!(stdout(), PopKeyboardEnhancementFlags)?; 35 + } 36 + 21 37 disable_raw_mode()?; 38 + 22 39 Ok(()) 23 40 }