clean up top and bottom rendering

This commit is contained in:
itsjunetime
2025-06-17 09:25:52 -06:00
parent 0578fccfa6
commit 02b447a98e
3 changed files with 14 additions and 21 deletions
Generated
+2 -2
View File
@@ -997,9 +997,9 @@ dependencies = [
[[package]] [[package]]
name = "flexi_logger" name = "flexi_logger"
version = "0.30.2" version = "0.31.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb03342077df16d5b1400d7bed00156882846d7a479ff61a6f10594bcc3423d8" checksum = "ab9765cc4ba26211f932a7a37649ec88752f7abcbd8822617572562ce31234df"
dependencies = [ dependencies = [
"chrono", "chrono",
"log", "log",
+1 -1
View File
@@ -46,7 +46,7 @@ memmap2 = "*"
# logging # logging
log = "0.4.27" log = "0.4.27"
flexi_logger = "0.30.2" flexi_logger = "0.31"
# for tracing with tokio-console # for tracing with tokio-console
console-subscriber = { version = "0.4.0", optional = true } console-subscriber = { version = "0.4.0", optional = true }
+11 -18
View File
@@ -428,31 +428,24 @@ impl Tui {
frame: &mut Frame<'_>, frame: &mut Frame<'_>,
bottom_msg: &BottomMessage bottom_msg: &BottomMessage
) { ) {
// use the extra space here to add some padding to the right side
let page_nums_text = format!("{} / {} ", page_num + 1, rendered.len());
let top_block = Block::new() let top_block = Block::new()
// use this first title to add a bit of padding to the left side
.title_top(" ")
.title_top(Span::styled(doc_name, Style::new().fg(Color::Cyan)))
.title_top(
Span::styled(&page_nums_text, Style::new().fg(Color::Cyan))
.into_right_aligned_line()
)
.padding(Padding { .padding(Padding {
right: 2, bottom: 1,
left: 2,
..Padding::default() ..Padding::default()
}) })
.borders(Borders::BOTTOM); .borders(Borders::BOTTOM);
let top_area = top_block.inner(top_area);
let page_nums_text = format!("{} / {}", page_num + 1, rendered.len());
let top_layout = Layout::horizontal([
Constraint::Fill(1),
Constraint::Length(page_nums_text.len() as u16)
])
.split(top_area);
let title = Span::styled(doc_name, Style::new().fg(Color::Cyan));
let page_nums = Span::styled(&page_nums_text, Style::new().fg(Color::Cyan));
frame.render_widget(top_block, top_area); frame.render_widget(top_block, top_area);
frame.render_widget(title, top_layout[0]);
frame.render_widget(page_nums, top_layout[1]);
let bottom_block = Block::new() let bottom_block = Block::new()
.padding(Padding { .padding(Padding {