mirror of
https://github.com/itsjunetime/tdf.git
synced 2026-06-02 08:01:47 -04:00
clean up top and bottom rendering
This commit is contained in:
Generated
+2
-2
@@ -997,9 +997,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "flexi_logger"
|
||||
version = "0.30.2"
|
||||
version = "0.31.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cb03342077df16d5b1400d7bed00156882846d7a479ff61a6f10594bcc3423d8"
|
||||
checksum = "ab9765cc4ba26211f932a7a37649ec88752f7abcbd8822617572562ce31234df"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"log",
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ memmap2 = "*"
|
||||
|
||||
# logging
|
||||
log = "0.4.27"
|
||||
flexi_logger = "0.30.2"
|
||||
flexi_logger = "0.31"
|
||||
|
||||
# for tracing with tokio-console
|
||||
console-subscriber = { version = "0.4.0", optional = true }
|
||||
|
||||
+11
-18
@@ -428,31 +428,24 @@ impl Tui {
|
||||
frame: &mut Frame<'_>,
|
||||
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()
|
||||
// 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 {
|
||||
right: 2,
|
||||
left: 2,
|
||||
bottom: 1,
|
||||
..Padding::default()
|
||||
})
|
||||
.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(title, top_layout[0]);
|
||||
frame.render_widget(page_nums, top_layout[1]);
|
||||
|
||||
let bottom_block = Block::new()
|
||||
.padding(Padding {
|
||||
|
||||
Reference in New Issue
Block a user