diff --git a/src/core/manager/watcher.rs b/src/core/manager/watcher.rs index 2e62be7d..43fd2364 100644 --- a/src/core/manager/watcher.rs +++ b/src/core/manager/watcher.rs @@ -60,7 +60,7 @@ impl Watcher { } } }, - notify::Config::default(), + Default::default(), ) .unwrap(); diff --git a/src/ui/header/layout.rs b/src/ui/header/layout.rs index 5856d790..59b517fb 100644 --- a/src/ui/header/layout.rs +++ b/src/ui/header/layout.rs @@ -13,7 +13,7 @@ impl<'a> Layout<'a> { impl<'a> Widget for Layout<'a> { fn render(self, area: Rect, buf: &mut Buffer) { - let chunks = layout::Layout::default() + let chunks = layout::Layout::new() .direction(Direction::Horizontal) .constraints([Constraint::Percentage(50), Constraint::Percentage(50)].as_ref()) .split(area); @@ -25,7 +25,7 @@ impl<'a> Widget for Layout<'a> { format!("{}", readable_home(¤t.cwd)) }; - Paragraph::new(location).style(Style::default().fg(Color::Cyan)).render(chunks[0], buf); + Paragraph::new(location).style(Style::new().fg(Color::Cyan)).render(chunks[0], buf); Tabs::new(self.cx).render(chunks[1], buf); } diff --git a/src/ui/input.rs b/src/ui/input.rs index 0407398c..01bed7d1 100644 --- a/src/ui/input.rs +++ b/src/ui/input.rs @@ -19,21 +19,21 @@ impl<'a> Widget for Input<'a> { Clear.render(area, buf); Paragraph::new(input.value()) .block( - Block::default() + Block::new() .borders(Borders::ALL) .border_type(BorderType::Rounded) - .border_style(Style::default().fg(Color::Blue)) + .border_style(Style::new().fg(Color::Blue)) .title({ let mut line = Line::from(input.title()); - line.patch_style(Style::default().fg(Color::White)); + line.patch_style(Style::new().fg(Color::White)); line }), ) - .style(Style::default().fg(Color::White)) + .style(Style::new().fg(Color::White)) .render(area, buf); if let Some(selected) = input.selected() { - buf.set_style(selected, Style::default().bg(Color::Rgb(72, 77, 102))) + buf.set_style(selected, Style::new().bg(Color::Rgb(72, 77, 102))) } let _ = match input.mode() { diff --git a/src/ui/manager/layout.rs b/src/ui/manager/layout.rs index 7d15dc53..d998c772 100644 --- a/src/ui/manager/layout.rs +++ b/src/ui/manager/layout.rs @@ -15,7 +15,7 @@ impl<'a> Widget for Layout<'a> { fn render(self, area: Rect, buf: &mut Buffer) { let manager = &self.cx.manager; - let chunks = layout::Layout::default() + let chunks = layout::Layout::new() .direction(Direction::Horizontal) .constraints( [ @@ -28,7 +28,7 @@ impl<'a> Widget for Layout<'a> { .split(area); // Parent - let block = Block::default().borders(Borders::RIGHT).padding(Padding::new(1, 0, 0, 0)); + let block = Block::new().borders(Borders::RIGHT).padding(Padding::new(1, 0, 0, 0)); if let Some(ref parent) = manager.parent() { Folder::new(self.cx, parent).render(block.inner(chunks[0]), buf); } @@ -40,7 +40,7 @@ impl<'a> Widget for Layout<'a> { .render(chunks[1], buf); // Preview - let block = Block::default().borders(Borders::LEFT).padding(Padding::new(0, 1, 0, 0)); + let block = Block::new().borders(Borders::LEFT).padding(Padding::new(0, 1, 0, 0)); Preview::new(self.cx).render(block.inner(chunks[2]), buf); block.render(chunks[2], buf); } diff --git a/src/ui/root.rs b/src/ui/root.rs index eef03a51..43227c72 100644 --- a/src/ui/root.rs +++ b/src/ui/root.rs @@ -12,7 +12,7 @@ impl<'a> Root<'a> { impl<'a> Widget for Root<'a> { fn render(self, area: Rect, buf: &mut Buffer) { - let chunks = Layout::default() + let chunks = Layout::new() .direction(Direction::Vertical) .constraints([Constraint::Length(1), Constraint::Min(0), Constraint::Length(1)].as_ref()) .split(area); diff --git a/src/ui/select.rs b/src/ui/select.rs index 4a328101..f99533b5 100644 --- a/src/ui/select.rs +++ b/src/ui/select.rs @@ -24,18 +24,18 @@ impl<'a> Widget for Select<'a> { return ListItem::new(format!(" {}", v)); } - ListItem::new(format!(" {}", v)).style(Style::default().fg(Color::Magenta)) + ListItem::new(format!(" {}", v)).style(Style::new().fg(Color::Magenta)) }) .collect::>(); Clear.render(area, buf); List::new(items) .block( - Block::default() + Block::new() .title(select.title()) .borders(Borders::ALL) .border_type(BorderType::Rounded) - .border_style(Style::default().fg(Color::Blue)), + .border_style(Style::new().fg(Color::Blue)), ) .render(area, buf); } diff --git a/src/ui/status/layout.rs b/src/ui/status/layout.rs index 593a55b2..eefbd034 100644 --- a/src/ui/status/layout.rs +++ b/src/ui/status/layout.rs @@ -13,7 +13,7 @@ impl<'a> Layout<'a> { impl<'a> Widget for Layout<'a> { fn render(self, area: Rect, buf: &mut Buffer) { - let chunks = layout::Layout::default() + let chunks = layout::Layout::new() .direction(Direction::Horizontal) .constraints([Constraint::Percentage(50), Constraint::Percentage(50)].as_ref()) .split(area); diff --git a/src/ui/tasks/layout.rs b/src/ui/tasks/layout.rs index 98007e7b..cd5fc327 100644 --- a/src/ui/tasks/layout.rs +++ b/src/ui/tasks/layout.rs @@ -11,7 +11,7 @@ impl<'a> Layout<'a> { pub fn new(cx: &'a Ctx) -> Self { Self { cx } } pub fn area(area: Rect) -> Rect { - let chunk = layout::Layout::default() + let chunk = layout::Layout::new() .direction(Direction::Vertical) .constraints( [ @@ -23,7 +23,7 @@ impl<'a> Layout<'a> { ) .split(area)[1]; - let chunk = layout::Layout::default() + let chunk = layout::Layout::new() .direction(Direction::Horizontal) .constraints( [ @@ -44,13 +44,13 @@ impl<'a> Widget for Layout<'a> { let area = Self::area(area); Clear.render(area, buf); - let block = Block::default() + let block = Block::new() .title("Tasks") .title_alignment(Alignment::Center) .padding(Padding::new(0, 0, 1, 1)) .borders(Borders::ALL) .border_type(BorderType::Rounded) - .border_style(Style::default().fg(Color::Rgb(128, 174, 250))); + .border_style(Style::new().fg(Color::Rgb(128, 174, 250))); block.clone().render(area, buf); let tasks = &self.cx.tasks; @@ -61,7 +61,7 @@ impl<'a> Widget for Layout<'a> { .map(|(i, v)| { let mut item = ListItem::new(v.name.clone()); if i == tasks.cursor { - item = item.style(Style::default().add_modifier(Modifier::UNDERLINED)); + item = item.style(Style::new().add_modifier(Modifier::UNDERLINED)); } item }) diff --git a/src/ui/which/layout.rs b/src/ui/which/layout.rs index 30335a3a..4653564d 100644 --- a/src/ui/which/layout.rs +++ b/src/ui/which/layout.rs @@ -1,4 +1,4 @@ -use ratatui::{layout, prelude::{Buffer, Constraint, Direction, Rect}, widgets::{Clear, Widget}}; +use ratatui::{layout, prelude::{Buffer, Constraint, Direction, Rect}, style::{Color, Style}, widgets::{Block, Clear, Widget}}; use super::Side; use crate::ui::Ctx; @@ -32,7 +32,7 @@ impl Widget for Which<'_> { height, }; - let chunks = layout::Layout::default() + let chunks = layout::Layout::new() .direction(Direction::Horizontal) .constraints( [Constraint::Ratio(1, 3), Constraint::Ratio(1, 3), Constraint::Ratio(1, 3)].as_ref(), @@ -40,6 +40,7 @@ impl Widget for Which<'_> { .split(area); Clear.render(area, buf); + Block::new().style(Style::new().bg(Color::Rgb(47, 51, 73))).render(area, buf); Side::new(which.times, cands.0).render(chunks[0], buf); Side::new(which.times, cands.1).render(chunks[1], buf); Side::new(which.times, cands.2).render(chunks[2], buf); diff --git a/src/ui/which/side.rs b/src/ui/which/side.rs index 2e0fe814..bccbd31a 100644 --- a/src/ui/which/side.rs +++ b/src/ui/which/side.rs @@ -1,4 +1,4 @@ -use ratatui::{prelude::{Buffer, Rect}, style::{Color, Style, Stylize}, text::{Line, Span}, widgets::{Block, List, ListItem, Padding, Widget}}; +use ratatui::{prelude::{Buffer, Rect}, style::{Color, Style}, text::{Line, Span}, widgets::{Block, List, ListItem, Padding, Widget}}; use crate::config::keymap::Control; @@ -22,28 +22,25 @@ impl Widget for Side<'_> { // Keys let keys = c.on[self.times..].iter().map(ToString::to_string).collect::>(); spans.push(Span::raw(" ".repeat(10usize.saturating_sub(keys.join("").len())))); - spans.push(Span::styled(keys[0].clone(), Style::default().fg(Color::LightCyan))); + spans.push(Span::styled(keys[0].clone(), Style::new().fg(Color::LightCyan))); spans.extend( keys .iter() .skip(1) - .map(|k| Span::styled(k.to_string(), Style::default().fg(Color::DarkGray))), + .map(|k| Span::styled(k.to_string(), Style::new().fg(Color::DarkGray))), ); // Separator - spans.push(Span::styled("  ".to_string(), Style::default().fg(Color::DarkGray))); + spans.push(Span::styled("  ".to_string(), Style::new().fg(Color::DarkGray))); // Exec let exec = c.exec.iter().map(ToString::to_string).collect::>().join("; "); - spans.push(Span::styled(exec, Style::default().fg(Color::Magenta))); + spans.push(Span::styled(exec, Style::new().fg(Color::Magenta))); ListItem::new(Line::from(spans)) }) .collect::>(); - List::new(items) - .block(Block::new().padding(Padding::new(0, 1, 1, 1))) - .bg(Color::Rgb(47, 51, 73)) - .render(area, buf); + List::new(items).block(Block::new().padding(Padding::new(0, 1, 1, 1))).render(area, buf); } }