aboutsummaryrefslogtreecommitdiff
path: root/src/tui
diff options
context:
space:
mode:
Diffstat (limited to 'src/tui')
-rw-r--r--src/tui/commands.rs4
-rw-r--r--src/tui/popup.rs4
-rw-r--r--src/tui/ui.rs18
3 files changed, 21 insertions, 5 deletions
diff --git a/src/tui/commands.rs b/src/tui/commands.rs
index 0e00f95..08ee677 100644
--- a/src/tui/commands.rs
+++ b/src/tui/commands.rs
@@ -57,6 +57,8 @@ pub enum CmdAction {
Confirm,
// Sort table/list
SortList,
+ //
+ SortById,
// Yank selected item
YankItem,
// Edit file
@@ -153,6 +155,8 @@ impl From<KeyEvent> for CmdAction {
KeyCode::Char('y') => Self::YankItem,
// Sort entry table by selected col
KeyCode::Char('s') => Self::SortList,
+ // Sort entry table by position in file
+ KeyCode::Char('S') => Self::SortById,
// Show help popup
KeyCode::Char('?') => Self::ShowHelp,
// Else do nothing
diff --git a/src/tui/popup.rs b/src/tui/popup.rs
index 78a0719..4ef9fc3 100644
--- a/src/tui/popup.rs
+++ b/src/tui/popup.rs
@@ -61,6 +61,10 @@ impl PopupArea {
("g|Home: ", "Go to first entry"),
("G|End: ", "Go to last entry"),
("s: ", "sort entries by selected column (toggles reversed)"),
+ (
+ "S: ",
+ "sort entries by position in/of file (toggles reversed)",
+ ),
("y: ", "yank/copy citekey of selected entry to clipboard"),
("e: ", "Open editor at selected entry"),
("o: ", "Open with selected entry associated PDF"),
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