diff --git a/default-config.toml b/default-config.toml index 60d057a..6a57569 100644 --- a/default-config.toml +++ b/default-config.toml @@ -35,10 +35,8 @@ reversed = false date_shown = true # The format of the date and time outputs. Formats can be found at https://strftime.org/. date_format = "%a %b %e %T %Y" -# The longest a username can be. -maximum_username_length = 26 -# Which side the username should be aligned to. -username_alignment = "right" +# If the username should be shown. +username_shown = true # The color palette for the username column: pastel (default), vibrant, warm, cool. palette = "pastel" # Show title with time and channel. diff --git a/src/commands.rs b/src/commands.rs index 2d87444..227b077 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -43,6 +43,7 @@ pub fn init_terminal(frontend_config: &FrontendConfig) -> Terminal SetCursorStyle::BlinkingBar, CursorType::Block => SetCursorStyle::BlinkingBlock, CursorType::UnderScore => SetCursorStyle::BlinkingUnderScore, + CursorType::User => SetCursorStyle::DefaultUserShape, }; let mut stdout = stdout(); diff --git a/src/handlers/args.rs b/src/handlers/args.rs index 8db2b50..b52b58f 100644 --- a/src/handlers/args.rs +++ b/src/handlers/args.rs @@ -78,9 +78,6 @@ pub struct Cli { /// Show the date/time #[arg(short, long)] pub date_shown: bool, - /// Maximum length for Twitch usernames - #[arg(short = 'u', long)] - pub max_username_length: Option, /// Username color palette #[arg(short, long)] pub palette: Option, @@ -121,9 +118,6 @@ pub fn merge_args_into_config(config: &mut CompleteConfig, args: Cli) { // Frontend arguments config.frontend.date_shown = config.frontend.date_shown || args.date_shown; - if let Some(maximum_username_length) = args.max_username_length { - config.frontend.maximum_username_length = maximum_username_length; - } if let Some(palette) = args.palette { config.frontend.palette = palette; } diff --git a/src/handlers/config.rs b/src/handlers/config.rs index bd36fe5..9b29983 100644 --- a/src/handlers/config.rs +++ b/src/handlers/config.rs @@ -89,8 +89,8 @@ pub struct FrontendConfig { pub date_shown: bool, /// The format of string that will show up in the terminal. pub date_format: String, - /// The maximum length of a Twitch username. - pub maximum_username_length: u16, + /// If the username should be shown. + pub username_shown: bool, /// The color palette. pub palette: Palette, /// Show Title with time and channel. @@ -141,7 +141,7 @@ impl Default for FrontendConfig { Self { date_shown: true, date_format: "%a %b %e %T %Y".to_string(), - maximum_username_length: 26, + username_shown: true, palette: Palette::default(), title_shown: true, margin: 0, diff --git a/src/handlers/data.rs b/src/handlers/data.rs index 083f6c7..7854383 100644 --- a/src/handlers/data.rs +++ b/src/handlers/data.rs @@ -74,8 +74,8 @@ impl MessageData { ) -> Vec { let width_sub_margin = width - (frontend_config.margin as usize * 2); - // Subtraction of 2 for the spaces in between the date, user, and message. - let first_line_limit = width_sub_margin - time_sent.len() - self.author.len() - 2; + // Subtraction of 2 for the spaces and ':' in between the date, user, and message. + let first_line_limit = width_sub_margin - time_sent.len() - self.author.len() - 3; let mut message_split = textwrap::wrap( &self.payload, @@ -158,18 +158,20 @@ impl MessageData { vec![] }; - info.extend(vec![ - Span::styled( - self.author.clone(), - if self.system { - SYSTEM_CHAT - } else { - Style::default().fg(self.hash_username(&frontend_config.palette)) - }, - ), - Span::raw(" "), - message_spans[0].clone(), - ]); + if frontend_config.username_shown { + info.extend(vec![ + Span::styled( + self.author.clone(), + if self.system { + SYSTEM_CHAT + } else { + Style::default().fg(self.hash_username(&frontend_config.palette)) + }, + ), + Span::raw(": "), + message_spans[0].clone(), + ]); + } let mut info_spans = vec![Spans::from(info)]; diff --git a/src/ui/mod.rs b/src/ui/mod.rs index 47e73d5..c3cfdbb 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -105,7 +105,7 @@ pub fn draw_ui(frame: &mut Frame, app: &mut App, config: &Complet let mut scroll_offset = app.scrolling.get_offset(); - // Horizontal chunks represents the table within the main chat window. + // Horizontal chunks represents the list within the main chat window. let h_chunk = Layout::default() .direction(Direction::Horizontal) .constraints([Constraint::Min(1)])