themes
This commit is contained in:
parent
01774cb9c2
commit
5c6ced8ca0
4 changed files with 69 additions and 21 deletions
|
|
@ -1,5 +1,6 @@
|
|||
use itertools::Itertools;
|
||||
use ratatui_themes::{Theme, ThemeName};
|
||||
use serde_json::de;
|
||||
use std::{
|
||||
fs::{self, DirEntry},
|
||||
io,
|
||||
|
|
@ -23,7 +24,7 @@ use ratatui::{
|
|||
crossterm::event::{self, Event, KeyCode, KeyModifiers},
|
||||
layout::{Constraint, HorizontalAlignment, Layout, Rect},
|
||||
style::Style,
|
||||
text::{Span, Text},
|
||||
text::{Line, Span, Text},
|
||||
widgets::{
|
||||
Block, Clear, List, ListItem, ListState, Padding, Paragraph, StatefulWidget, Widget, Wrap,
|
||||
},
|
||||
|
|
@ -35,9 +36,9 @@ pub mod model;
|
|||
pub mod processing;
|
||||
pub mod reader;
|
||||
|
||||
pub fn run(logs_dir: PathBuf, compiler_root: Option<PathBuf>) {
|
||||
pub fn run(logs_dir: PathBuf, compiler_root: Option<PathBuf>, theme: ThemeName) {
|
||||
let terminal = ratatui::init();
|
||||
let theme = Theme::new(ThemeName::OneDarkPro);
|
||||
let theme = Theme::new(theme);
|
||||
let app_result = App::new(logs_dir, compiler_root, theme).run(terminal);
|
||||
ratatui::restore();
|
||||
|
||||
|
|
@ -458,12 +459,13 @@ impl Widget for &mut App {
|
|||
{
|
||||
let full_file_path = canonical_rustc_root.join(&file);
|
||||
Hyperlink::new(
|
||||
format!("In file: {}", file.display()),
|
||||
Line::from(format!("In file: {}", file.display())).style(default),
|
||||
format!("file://{}:{line}", full_file_path.display()),
|
||||
)
|
||||
.render(first_line, buf);
|
||||
} else {
|
||||
Span::from(format!("In file: {}:{line}", file.display()))
|
||||
Line::from(format!("In file: {}:{line}", file.display()))
|
||||
.style(default)
|
||||
.render(first_line, buf);
|
||||
}
|
||||
}
|
||||
|
|
@ -489,7 +491,7 @@ impl Widget for &mut App {
|
|||
(res, height)
|
||||
});
|
||||
|
||||
let list = ListView::new(builder, items.len());
|
||||
let list = ListView::new(builder, items.len()).style(default);
|
||||
StatefulWidget::render(list, footer_area, buf, &mut lv.footer_list);
|
||||
}
|
||||
Tab::Empty => {}
|
||||
|
|
|
|||
|
|
@ -91,10 +91,11 @@ impl LogEntry {
|
|||
|
||||
pub fn line_text(&self, accessed: bool, inline_depth: usize) -> Line<'static> {
|
||||
const NO_MESSAGE: &str = "<no message>";
|
||||
const SPACES_BEFORE: &str = " ";
|
||||
let indent = " >".repeat(inline_depth);
|
||||
match self {
|
||||
LogEntry::Single { raw } => format!(
|
||||
" ┃{}{}",
|
||||
" >".repeat(inline_depth),
|
||||
"{SPACES_BEFORE}┃{indent}{}",
|
||||
raw.fields.message().unwrap_or(NO_MESSAGE)
|
||||
)
|
||||
.into(),
|
||||
|
|
@ -105,13 +106,13 @@ impl LogEntry {
|
|||
&& let Some(s) = val.as_str()
|
||||
{
|
||||
Line::from(format!(
|
||||
"{:3}⭣{:3}⇊ ┃↪ {s}",
|
||||
"{:4}⭣{:4}⇊ ┃{indent}↪ {s}",
|
||||
sub_entries.len(),
|
||||
self.count().wrapping_sub(1)
|
||||
))
|
||||
} else {
|
||||
format!(
|
||||
" ┃{}",
|
||||
"{SPACES_BEFORE}┃{indent}{}",
|
||||
enter.fields.message().unwrap_or(NO_MESSAGE)
|
||||
)
|
||||
.into()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue