aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlukeflo2025-06-30 21:49:53 +0200
committerlukeflo2025-06-30 21:49:53 +0200
commit9bd2f6fef0d835ffb97e18993161e6639c98d2d1 (patch)
tree1ff5038fbeda1fe8ee9643a1611b3009345779f5 /src
parent3a40bbb367a79dc3660c12aa7f62e3efc378ea22 (diff)
downloadbibiman-9bd2f6fef0d835ffb97e18993161e6639c98d2d1.tar.gz
bibiman-9bd2f6fef0d835ffb97e18993161e6639c98d2d1.zip
align resource symbols, update README
Diffstat (limited to 'src')
-rw-r--r--src/app.rs13
-rw-r--r--src/bibiman.rs2
-rw-r--r--src/tui/ui.rs19
3 files changed, 27 insertions, 7 deletions
diff --git a/src/app.rs b/src/app.rs
index 18a97e6..f912614 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -16,15 +16,14 @@
/////
use crate::bibiman::CurrentArea;
-use crate::config::BibiConfig;
-use color_eyre::eyre::{Context, Ok, Result};
-use editor_command::EditorBuilder;
-// use super::Event;
use crate::cliargs::CLIArgs;
+use crate::config::BibiConfig;
use crate::tui::commands::InputCmdAction;
use crate::tui::popup::PopupKind;
use crate::tui::{self, Tui};
use crate::{bibiman::Bibiman, tui::commands::CmdAction};
+use color_eyre::eyre::{Context, Ok, Result};
+use crossterm::event::KeyCode;
use std::ffi::OsStr;
use std::path::PathBuf;
use std::process::{Command, Stdio};
@@ -84,6 +83,12 @@ impl App {
self.bibiman.popup_area.popup_kind
{
self.bibiman.fast_selection(cfg, &mut tui, key_event.code)?;
+ // if a fast match char was used, restart event-loop.
+ // otherwise, the fast match char will be executed as command
+ match key_event.code {
+ KeyCode::Char('o' | 'l' | 'n' | 'y') => continue,
+ _ => {}
+ }
}
let command = if self.input_mode {
CmdAction::Input(InputCmdAction::parse(key_event, &self.input))
diff --git a/src/bibiman.rs b/src/bibiman.rs
index 9cc9280..f95bbc0 100644
--- a/src/bibiman.rs
+++ b/src/bibiman.rs
@@ -35,7 +35,7 @@ use std::fs::{self, read_to_string};
use std::fs::{File, OpenOptions};
use std::io::Write;
use std::path::PathBuf;
-use std::process::{Command, Stdio};
+use std::process::Command;
use std::result::Result::Ok;
use tui_input::Input;
diff --git a/src/tui/ui.rs b/src/tui/ui.rs
index 3c83935..be53f61 100644
--- a/src/tui/ui.rs
+++ b/src/tui/ui.rs
@@ -300,7 +300,7 @@ pub fn render_popup(app: &mut App, cfg: &BibiConfig, frame: &mut Frame) {
};
let bottom_info = if let Some(PopupKind::OpenRes) = app.bibiman.popup_area.popup_kind {
- " (j,k|↓,↑) ━ (o,l) ━ (ENTER) ━ (ESC) ".bold()
+ " (j,k|↓,↑) ━ (o,l,n) ━ (ENTER) ━ (ESC) ".bold()
} else if let Some(PopupKind::YankItem) = app.bibiman.popup_area.popup_kind {
" (j,k|↓,↑) ━ (y) ━ (ENTER) ━ (ESC) ".bold()
} else {
@@ -580,7 +580,7 @@ pub fn render_entrytable(app: &mut App, cfg: &BibiConfig, frame: &mut Frame, rec
.bg(cfg.colors.bar_bg_color);
let header = Row::new(vec![
- Cell::from(Line::from("")).bg(cfg.colors.bar_bg_color),
+ Cell::from(Line::from("Res.")).bg(cfg.colors.bar_bg_color),
Cell::from(
Line::from(vec![{ Span::raw("Author") }, {
if let Some(EntryTableColumn::Authors) =
@@ -703,23 +703,38 @@ pub fn render_entrytable(app: &mut App, cfg: &BibiConfig, frame: &mut Frame, rec
let mut symbol_vec = vec![];
+ // use default or custom symbols for resources
+ // if an entry has no, replace it with the correct number
+ // of whitespace to align the symbols correct
if let Some(f) = &item.symbols[0] {
symbol_vec.push(Span::styled(
f,
Style::new().fg(cfg.colors.file_color).bold(),
));
+ } else {
+ symbol_vec.push(Span::raw(
+ " ".repeat(cfg.general.file_symbol.chars().count()),
+ ));
}
if let Some(l) = &item.symbols[1] {
symbol_vec.push(Span::styled(
l,
Style::new().fg(cfg.colors.link_color).bold(),
));
+ } else {
+ symbol_vec.push(Span::raw(
+ " ".repeat(cfg.general.link_symbol.chars().count()),
+ ));
}
if let Some(n) = &item.symbols[2] {
symbol_vec.push(Span::styled(
n,
Style::new().fg(cfg.colors.note_color).bold(),
))
+ } else {
+ symbol_vec.push(Span::raw(
+ " ".repeat(cfg.general.note_symbol.chars().count()),
+ ));
}
let row = Row::new(vec![