spinners and fmt
This commit is contained in:
+10
-3
@@ -3,6 +3,7 @@
|
||||
//! [`LogWidget`] renders the scrollable log panel as a ratatui [`StatefulWidget`];
|
||||
//! [`LogState`] holds whether the panel is open, its height, and scroll position.
|
||||
|
||||
use crate::utils::rgba8_to_color;
|
||||
use kiln_core::log::{LogLine, LogSpan};
|
||||
use ratatui::buffer::Buffer;
|
||||
use ratatui::layout::Rect;
|
||||
@@ -10,7 +11,6 @@ use ratatui::style::{Color, Style};
|
||||
use ratatui::symbols::merge::MergeStrategy;
|
||||
use ratatui::text::{Line, Span};
|
||||
use ratatui::widgets::{Block, Paragraph, StatefulWidget, Widget, Wrap};
|
||||
use crate::utils::rgba8_to_color;
|
||||
|
||||
/// View state for the log panel.
|
||||
pub struct LogState {
|
||||
@@ -24,7 +24,11 @@ pub struct LogState {
|
||||
|
||||
impl Default for LogState {
|
||||
fn default() -> Self {
|
||||
Self { open: false, height: 10, scroll: 0 }
|
||||
Self {
|
||||
open: false,
|
||||
height: 10,
|
||||
scroll: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +78,10 @@ impl StatefulWidget for LogWidget<'_> {
|
||||
fn render(self, area: Rect, buf: &mut Buffer, state: &mut LogState) {
|
||||
let block = Block::bordered()
|
||||
.merge_borders(MergeStrategy::Exact)
|
||||
.title(Span::styled(" [l]og: ", Style::default().fg(Color::DarkGray)));
|
||||
.title(Span::styled(
|
||||
" [l]og: ",
|
||||
Style::default().fg(Color::DarkGray),
|
||||
));
|
||||
let lines: Vec<Line> = self.logs.iter().rev().map(logline_to_line).collect();
|
||||
Paragraph::new(lines)
|
||||
.block(block)
|
||||
|
||||
Reference in New Issue
Block a user