summaryrefslogtreecommitdiff
path: root/src/widgets/logview.rs
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2024-07-28 12:50:02 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2024-07-28 12:50:02 +0200
commit417cee4eeeaf7516dfeb59cdbe34fed18f30e0f7 (patch)
tree74354a7b14a65f4dc514b6ed0367945f69349bc4 /src/widgets/logview.rs
parent6ca07d6af8a338e76817d06c6c6c6f13e64fba9c (diff)
add statusbar widget
Diffstat (limited to 'src/widgets/logview.rs')
-rw-r--r--src/widgets/logview.rs27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/widgets/logview.rs b/src/widgets/logview.rs
index 4259e35..c5b6432 100644
--- a/src/widgets/logview.rs
+++ b/src/widgets/logview.rs
@@ -1,29 +1,28 @@
-use ratatui::{text::ToSpan, widgets::{block::BlockExt, Block, Widget}};
+use ratatui::{style::{Style, Stylize}, text::ToSpan, widgets::Widget};
use crate::lua::iobuffer::iobuffer;
+use super::statusbar::StatusBar;
-pub struct LogView<'a> {
- block: Option<Block<'a>>
+pub struct LogView {
+ bar: StatusBar,
}
-impl<'a> LogView<'a> {
+impl LogView {
pub fn new() -> Self {
- Self { block: None }
- }
-
- pub fn block(mut self, block: Block<'a>) -> Self {
- self.block = Some(block);
- self
+ Self {
+ bar: StatusBar::new().left(" Log ").left_style(Style::default().on_magenta()),
+ }
}
}
-impl Widget for &mut LogView<'_> {
+impl Widget for &mut LogView {
fn render(self, area: ratatui::prelude::Rect, buf: &mut ratatui::prelude::Buffer)
where
- Self: Sized {
- self.block.render(area, buf);
- let inner_area = self.block.inner_if_some(area);
+ Self: Sized,
+ {
+ self.bar.render(area, buf);
+ let inner_area = self.bar.area(area);
let lines = {
let buffer = iobuffer().read().unwrap();