From 0312b8b31160297033e8a435c00e7c92eaa371e6 Mon Sep 17 00:00:00 2001 From: lukeflo Date: Wed, 25 Dec 2024 22:32:42 +0100 Subject: Minor Feature: Sort entries by position in/of file + Hitting now sorts the entries by position in file or position of files + Can be helpful to detect entries newly added via DOI which are appended to EOF --- src/tui/ui.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/tui/ui.rs') diff --git a/src/tui/ui.rs b/src/tui/ui.rs index 4f64338..d85f318 100644 --- a/src/tui/ui.rs +++ b/src/tui/ui.rs @@ -563,7 +563,8 @@ pub fn render_entrytable(app: &mut App, args: &CLIArgs, frame: &mut Frame, rect: let header = Row::new(vec![ Cell::from( Line::from(vec![{ Span::raw("Author") }, { - if let EntryTableColumn::Authors = app.bibiman.entry_table.entry_table_sorted_by_col + if let Some(EntryTableColumn::Authors) = + app.bibiman.entry_table.entry_table_sorted_by_col { Span::raw(format!( " {}", @@ -589,7 +590,9 @@ pub fn render_entrytable(app: &mut App, args: &CLIArgs, frame: &mut Frame, rect: ), Cell::from( Line::from(vec![{ Span::raw("Title") }, { - if let EntryTableColumn::Title = app.bibiman.entry_table.entry_table_sorted_by_col { + if let Some(EntryTableColumn::Title) = + app.bibiman.entry_table.entry_table_sorted_by_col + { Span::raw(format!( " {}", if app.bibiman.entry_table.entry_table_reversed_sort { @@ -613,7 +616,9 @@ pub fn render_entrytable(app: &mut App, args: &CLIArgs, frame: &mut Frame, rect: ), Cell::from( Line::from(vec![{ Span::raw("Year") }, { - if let EntryTableColumn::Year = app.bibiman.entry_table.entry_table_sorted_by_col { + if let Some(EntryTableColumn::Year) = + app.bibiman.entry_table.entry_table_sorted_by_col + { Span::raw(format!( " {}", if app.bibiman.entry_table.entry_table_reversed_sort { @@ -637,7 +642,8 @@ pub fn render_entrytable(app: &mut App, args: &CLIArgs, frame: &mut Frame, rect: ), Cell::from( Line::from(vec![{ Span::raw("Pubtype") }, { - if let EntryTableColumn::Pubtype = app.bibiman.entry_table.entry_table_sorted_by_col + if let Some(EntryTableColumn::Pubtype) = + app.bibiman.entry_table.entry_table_sorted_by_col { Span::raw(format!( " {}", @@ -698,7 +704,9 @@ pub fn render_entrytable(app: &mut App, args: &CLIArgs, frame: &mut Frame, rect: Constraint::Percentage(20), Constraint::Fill(1), Constraint::Length( - if let EntryTableColumn::Year = app.bibiman.entry_table.entry_table_sorted_by_col { + if let Some(EntryTableColumn::Year) = + app.bibiman.entry_table.entry_table_sorted_by_col + { 6 } else { 4 -- cgit v1.2.3