aboutsummaryrefslogtreecommitdiff
path: root/src/tui
diff options
context:
space:
mode:
authorlukeflo2024-11-14 16:38:19 +0100
committerlukeflo2024-11-14 16:38:19 +0100
commitb8e470fb3bc768ef9a1146061f81dac8e7a8deb4 (patch)
treeeffb29dbab462dfe78bec4262063c208a4bb5e43 /src/tui
parentf251969044036ecfbc2cd4774c9ecb97b1992bb3 (diff)
downloadbibiman-b8e470fb3bc768ef9a1146061f81dac8e7a8deb4.tar.gz
bibiman-b8e470fb3bc768ef9a1146061f81dac8e7a8deb4.zip
change style of popups, calculate width by content
Diffstat (limited to 'src/tui')
-rw-r--r--src/tui/ui.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/tui/ui.rs b/src/tui/ui.rs
index fbfd40a..fed893f 100644
--- a/src/tui/ui.rs
+++ b/src/tui/ui.rs
@@ -48,7 +48,7 @@ const MAIN_GREEN: Color = Color::Indexed(MAIN_GREEN_COLOR_INDEX);
// Background colors
const HEADER_FOOTER_BG: Color = Color::Indexed(235);
-const POPUP_BG: Color = Color::Indexed(233);
+const POPUP_BG: Color = Color::Indexed(234);
// Box styles
// Keyword Box
@@ -166,17 +166,25 @@ pub fn render_popup(app: &mut App, frame: &mut Frame) {
};
let par = Paragraph::new(text).scroll((scroll_pos, 0));
+ let par_width = par.line_width();
// Needed to use scrollable Parapgraph as popup content
let sized_par = SizedWrapper {
inner: par,
- width: (frame.area().width / 2) as usize,
+ // width: (frame.area().width / 2) as usize,
+ width: if par_width > frame.area().width as usize {
+ frame.area().width as usize
+ } else {
+ par_width
+ },
+ // width: par_width,
height: (frame.area().height / 2) as usize,
};
let popup = Popup::new(sized_par)
.title(" Keybindings (j,k|↓,↑)".bold().into_centered_line())
.style(POPUP_HELP_BOX)
+ .border_set(symbols::border::THICK)
.border_style(Style::new().fg(MAIN_BLUE));
frame.render_widget_ref(popup, frame.area())
@@ -184,6 +192,8 @@ pub fn render_popup(app: &mut App, frame: &mut Frame) {
let popup =
Popup::new(Text::from(app.bibiman.popup_area.popup_message.as_str()).fg(MAIN_GREEN))
.title(" Message ".bold().into_centered_line().fg(MAIN_GREEN))
+ .border_set(symbols::border::THICK)
+ .border_style(Style::new().fg(MAIN_GREEN))
.style(POPUP_HELP_BOX);
frame.render_widget(&popup, frame.area())
} else {
class="s2">"https://codeberg.org/lukeflo/bibiman" readme = "README.md" description = "TUI for interacting with BibLaTeX databases" keywords = ["tui", "biblatex", "bibliography", "bibtex", "latex"] categories = ["command-line-utilities"] edition = "2021" exclude = ["/tests", ".*"] [profile.release-git] inherits = "release" lto = "fat" [dependencies] arboard = { version = "3.4.1", features = ["wayland-data-control"] } biblatex = "0.10.0" color-eyre = "0.6.3" crossterm = { version = "0.28.1", features = ["event-stream"] } dirs = "5.0.1" editor-command = "0.1.1" futures = "0.3.30" rand = "0.8" itertools = "0.13.0" lexopt = "0.3.0" nucleo-matcher = "0.3.1" ratatui = { version = "0.29.0", features = ["unstable-rendered-line-info", "serde"]} signal-hook = "0.3.17" tokio = { version = "1.39.3", features = ["full"] } tokio-util = "0.7.12" tui-input = "0.11.0" walkdir = "2.5.0" regex = "1.11.1" ureq = "2.12.1" # config = { version = "0.15.8", default-features = false, features = ["async", "async-trait", "convert-case", "convert_case", "toml"] } serde = { version = "1.0.217", features = ["serde_derive"] } figment = { version = "0.10.19", features = [ "toml", "test" ]} owo-colors = "4.2.2"