formatting

This commit is contained in:
alexpasmantier 2024-10-31 14:09:23 +01:00
parent 40f466548b
commit 856c570e27
3 changed files with 17 additions and 15 deletions

View File

@ -219,7 +219,7 @@ impl OnAir for Channel {
.matched_items( .matched_items(
offset offset
..(num_entries + offset) ..(num_entries + offset)
.min(snapshot.matched_item_count()), .min(snapshot.matched_item_count()),
) )
.map(move |item| { .map(move |item| {
snapshot.pattern().column_pattern(0).indices( snapshot.pattern().column_pattern(0).indices(
@ -238,11 +238,11 @@ impl OnAir for Channel {
display_path.clone() + &item.data.line_number.to_string(), display_path.clone() + &item.data.line_number.to_string(),
PreviewType::Files, PreviewType::Files,
) )
.with_display_name(display_path) .with_display_name(display_path)
.with_value(line) .with_value(line)
.with_value_match_ranges(indices.map(|i| (i, i + 1)).collect()) .with_value_match_ranges(indices.map(|i| (i, i + 1)).collect())
.with_icon(FileIcon::from(item.data.path.as_path())) .with_icon(FileIcon::from(item.data.path.as_path()))
.with_line_number(item.data.line_number) .with_line_number(item.data.line_number)
}) })
.collect() .collect()
} }
@ -364,7 +364,7 @@ fn try_inject_lines(
if (bytes_read == 0) if (bytes_read == 0)
|| is_not_text(&buffer).unwrap_or(false) || is_not_text(&buffer).unwrap_or(false)
|| proportion_of_printable_ascii_characters(&buffer) || proportion_of_printable_ascii_characters(&buffer)
< PRINTABLE_ASCII_THRESHOLD < PRINTABLE_ASCII_THRESHOLD
{ {
return None; return None;
} }

View File

@ -333,12 +333,14 @@ impl Television {
} }
} }
} }
Action::CopyEntryToClipboard => if self.mode == Mode::Channel { Action::CopyEntryToClipboard => {
if let Some(entry) = self.get_selected_entry(None) { if self.mode == Mode::Channel {
let mut ctx = ClipboardContext::new().unwrap(); if let Some(entry) = self.get_selected_entry(None) {
ctx.set_contents(entry.name).unwrap(); let mut ctx = ClipboardContext::new().unwrap();
ctx.set_contents(entry.name).unwrap();
}
} }
}, }
Action::ToggleSendToChannel => match self.mode { Action::ToggleSendToChannel => match self.mode {
Mode::Channel | Mode::RemoteControl => { Mode::Channel | Mode::RemoteControl => {
self.mode = Mode::SendToChannel; self.mode = Mode::SendToChannel;

View File

@ -174,9 +174,9 @@ impl Television {
self.preview_scroll.unwrap_or(0), self.preview_scroll.unwrap_or(0),
self.preview_pane_height, self.preview_pane_height,
) )
.block(preview_block) .block(preview_block)
.alignment(Alignment::Left) .alignment(Alignment::Left)
.scroll((self.preview_scroll.unwrap_or(0), 0)) .scroll((self.preview_scroll.unwrap_or(0), 0))
} }
// meta // meta
PreviewContent::Loading => self PreviewContent::Loading => self