aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--src/app.rs13
-rw-r--r--src/bibiman.rs2
-rw-r--r--src/tui/ui.rs19
-rw-r--r--tests/test-config.toml6
5 files changed, 32 insertions, 10 deletions
diff --git a/README.md b/README.md
index 4f0e505..ed620e8 100644
--- a/README.md
+++ b/README.md
@@ -45,6 +45,8 @@ Here's a small impression how it looks and works:
[![bibiman.gif](https://i.postimg.cc/Y0mCNDMg/bibiman.gif)](https://postimg.cc/ct0W0mK4)
+![screenshot with new note feature](https://codeberg.org/attachments/69d35f36-cff3-43e5-8bfd-361064ba8ab2)
+
## Installation<a name="installation"></a>
### Crates.io<a name="cratesio"></a>
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![
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