diff options
| author | lukeflo | 2025-06-30 21:49:53 +0200 |
|---|---|---|
| committer | lukeflo | 2025-06-30 21:49:53 +0200 |
| commit | 9bd2f6fef0d835ffb97e18993161e6639c98d2d1 (patch) | |
| tree | 1ff5038fbeda1fe8ee9643a1611b3009345779f5 | |
| parent | 3a40bbb367a79dc3660c12aa7f62e3efc378ea22 (diff) | |
| download | bibiman-9bd2f6fef0d835ffb97e18993161e6639c98d2d1.tar.gz bibiman-9bd2f6fef0d835ffb97e18993161e6639c98d2d1.zip | |
align resource symbols, update README
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | src/app.rs | 13 | ||||
| -rw-r--r-- | src/bibiman.rs | 2 | ||||
| -rw-r--r-- | src/tui/ui.rs | 19 | ||||
| -rw-r--r-- | tests/test-config.toml | 6 |
5 files changed, 32 insertions, 10 deletions
@@ -45,6 +45,8 @@ Here's a small impression how it looks and works: [](https://postimg.cc/ct0W0mK4) + + ## Installation<a name="installation"></a> ### Crates.io<a name="cratesio"></a> @@ -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![ diff --git a/tests/test-config.toml b/tests/test-config.toml index 51bd4e6..1d29043 100644 --- a/tests/test-config.toml +++ b/tests/test-config.toml @@ -28,9 +28,9 @@ note_path = "tests/note-files" note_extensions = [ "md", "txt" ] ## Symbols/chars to show if not has specific attachement - file_symbol = " " - link_symbol = " " - note_symbol = "" +file_symbol = " " +link_symbol = " " +note_symbol = "" # [colors] ## Default values for dark-themed terminal |
