From 856c570e27dc4f6624ae1c45c14558ce10cf4970 Mon Sep 17 00:00:00 2001 From: alexpasmantier Date: Thu, 31 Oct 2024 14:09:23 +0100 Subject: [PATCH] formatting --- crates/television/channels/text.rs | 14 +++++++------- crates/television/television.rs | 12 +++++++----- crates/television/ui/preview.rs | 6 +++--- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/crates/television/channels/text.rs b/crates/television/channels/text.rs index db78d43..28f4495 100644 --- a/crates/television/channels/text.rs +++ b/crates/television/channels/text.rs @@ -219,7 +219,7 @@ impl OnAir for Channel { .matched_items( offset ..(num_entries + offset) - .min(snapshot.matched_item_count()), + .min(snapshot.matched_item_count()), ) .map(move |item| { snapshot.pattern().column_pattern(0).indices( @@ -238,11 +238,11 @@ impl OnAir for Channel { display_path.clone() + &item.data.line_number.to_string(), PreviewType::Files, ) - .with_display_name(display_path) - .with_value(line) - .with_value_match_ranges(indices.map(|i| (i, i + 1)).collect()) - .with_icon(FileIcon::from(item.data.path.as_path())) - .with_line_number(item.data.line_number) + .with_display_name(display_path) + .with_value(line) + .with_value_match_ranges(indices.map(|i| (i, i + 1)).collect()) + .with_icon(FileIcon::from(item.data.path.as_path())) + .with_line_number(item.data.line_number) }) .collect() } @@ -364,7 +364,7 @@ fn try_inject_lines( if (bytes_read == 0) || is_not_text(&buffer).unwrap_or(false) || proportion_of_printable_ascii_characters(&buffer) - < PRINTABLE_ASCII_THRESHOLD + < PRINTABLE_ASCII_THRESHOLD { return None; } diff --git a/crates/television/television.rs b/crates/television/television.rs index b9837c0..ef87a0a 100644 --- a/crates/television/television.rs +++ b/crates/television/television.rs @@ -333,12 +333,14 @@ impl Television { } } } - Action::CopyEntryToClipboard => if self.mode == Mode::Channel { - if let Some(entry) = self.get_selected_entry(None) { - let mut ctx = ClipboardContext::new().unwrap(); - ctx.set_contents(entry.name).unwrap(); + Action::CopyEntryToClipboard => { + if self.mode == Mode::Channel { + if let Some(entry) = self.get_selected_entry(None) { + let mut ctx = ClipboardContext::new().unwrap(); + ctx.set_contents(entry.name).unwrap(); + } } - }, + } Action::ToggleSendToChannel => match self.mode { Mode::Channel | Mode::RemoteControl => { self.mode = Mode::SendToChannel; diff --git a/crates/television/ui/preview.rs b/crates/television/ui/preview.rs index 86dc4e0..65e5615 100644 --- a/crates/television/ui/preview.rs +++ b/crates/television/ui/preview.rs @@ -174,9 +174,9 @@ impl Television { self.preview_scroll.unwrap_or(0), self.preview_pane_height, ) - .block(preview_block) - .alignment(Alignment::Left) - .scroll((self.preview_scroll.unwrap_or(0), 0)) + .block(preview_block) + .alignment(Alignment::Left) + .scroll((self.preview_scroll.unwrap_or(0), 0)) } // meta PreviewContent::Loading => self