Skip to content

Commit

Permalink
Merge pull request #2 from nicochatzi/dependabot/cargo/ratatui-0.24.0
Browse files Browse the repository at this point in the history
Update ratatui requirement from 0.23.0 to 0.24.0
  • Loading branch information
nico authored Nov 11, 2023
2 parents 6816688 + b3366e7 commit f8c0a32
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 25 deletions.
2 changes: 1 addition & 1 deletion aud/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ crossbeam = { workspace = true }
log = { workspace = true }
fern = { workspace = true }
crossterm = "0.27.0"
ratatui = "0.23.0"
ratatui = "0.24.0"
humantime = "2.1.0"
clap = { version = "4.4.3", features = ["derive"] }
clap_complete = "4.4.1"
Expand Down
2 changes: 1 addition & 1 deletion aud/cli/src/cmd/auscope/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl crate::app::Base for TerminalApp {
}
}

fn render(&mut self, f: &mut Frame<impl Backend>) {
fn render(&mut self, f: &mut Frame) {
self.ui.render(f, &mut self.app);
}
}
Expand Down
2 changes: 1 addition & 1 deletion aud/cli/src/cmd/auscope/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl Ui {
UiEvent::Continue
}

pub fn render(&mut self, f: &mut Frame<impl Backend>, app: &mut super::AuscopeApp) {
pub fn render(&mut self, f: &mut Frame, app: &mut super::AuscopeApp) {
let sections = Layout::default()
.direction(Direction::Horizontal)
.margin(1)
Expand Down
2 changes: 1 addition & 1 deletion aud/cli/src/cmd/derlink/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl crate::app::Base for TerminalApp {
Ok(crate::app::Flow::Continue)
}

fn render(&mut self, f: &mut Frame<impl Backend>) {
fn render(&mut self, f: &mut Frame) {
self.ui.render(f, &mut self.app)
}
}
Expand Down
2 changes: 1 addition & 1 deletion aud/cli/src/cmd/derlink/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub struct Ui {
}

impl Ui {
pub fn render<B: Backend>(&mut self, f: &mut Frame<B>, app: &mut aud::apps::derlink::app::App) {
pub fn render(&mut self, f: &mut Frame, app: &mut aud::apps::derlink::app::App) {
let sections = Layout::default()
.direction(Direction::Horizontal)
.margin(1)
Expand Down
2 changes: 1 addition & 1 deletion aud/cli/src/cmd/midimon/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl crate::app::Base for TerminalApp {
Ok(crate::app::Flow::Continue)
}

fn render(&mut self, f: &mut Frame<impl Backend>) {
fn render(&mut self, f: &mut Frame) {
if let Some(alert) = self.app.take_alert() {
self.ui.show_alert_message(&alert);
}
Expand Down
2 changes: 1 addition & 1 deletion aud/cli/src/cmd/midimon/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ impl Ui {
Ok(UiEvent::Continue)
}

pub fn render(&mut self, f: &mut Frame<impl Backend>, app: &App) {
pub fn render(&mut self, f: &mut Frame, app: &App) {
let sections = Layout::default()
.direction(Direction::Vertical)
.margin(1)
Expand Down
2 changes: 1 addition & 1 deletion aud/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub mod app {
}

/// Render the terminal UI frame
fn render(&mut self, frame: &mut Frame<impl Backend>);
fn render(&mut self, frame: &mut Frame);
}

pub fn run(
Expand Down
2 changes: 1 addition & 1 deletion aud/cli/src/ui/components/popups.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ where
self.visible == Some(popup)
}

pub fn render(&mut self, f: &mut Frame<impl Backend>, popup: Key, title: &str, text: &str) {
pub fn render(&mut self, f: &mut Frame, popup: Key, title: &str, text: &str) {
if self.visible.is_none() {
return;
}
Expand Down
5 changes: 2 additions & 3 deletions aud/cli/src/ui/components/selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,15 @@ impl Selector {
self.selection
}

pub fn render<'a, B, T>(
pub fn render<'a, T>(
&'a mut self,
f: &mut Frame<B>,
f: &mut Frame,
area: Rect,
title: &'a str,
items: &[T],
is_highlighted: bool,
) where
for<'b> Cow<'b, str>: From<&'b T>,
B: Backend,
{
let items: Vec<ListItem> = items
.iter()
Expand Down
5 changes: 2 additions & 3 deletions aud/cli/src/ui/components/selectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,15 @@ where
})
}

pub fn render<'a, B, T>(
pub fn render<'a, T>(
&'a mut self,
f: &mut Frame<B>,
f: &mut Frame,
area: Rect,
selector: Key,
title: &'a str,
elements: &[T],
) where
for<'b> Cow<'b, str>: From<&'b T>,
B: Backend,
{
let is_focused = self.focused.as_ref() == Some(&selector);

Expand Down
7 changes: 1 addition & 6 deletions aud/cli/src/ui/widgets/midi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,7 @@ use ratatui::{
widgets::{Block, Borders, List, ListItem},
};

pub fn render_messages(
f: &mut Frame<impl Backend>,
title: &str,
messages: &[MidiMessageString],
area: Rect,
) {
pub fn render_messages(f: &mut Frame, title: &str, messages: &[MidiMessageString], area: Rect) {
const MAX_NUM_MESSAGES_ON_SCREEN: usize = 128;

let message_list: Vec<ListItem> = messages
Expand Down
8 changes: 4 additions & 4 deletions aud/cli/src/ui/widgets/popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ lazy_static::lazy_static! {
static ref LUA: &'static parsing::SyntaxReference = PS.find_syntax_by_extension("lua").unwrap();
}

pub fn render_code<B: Backend>(f: &mut Frame<B>, title: &str, code_text: &str) {
pub fn render_code(f: &mut Frame, title: &str, code_text: &str) {
let mut h = easy::HighlightLines::new(&LUA, &THEME);
let (block, area) = setup_popup(f, title, 80, 80);
let code = get_highlighted_code(&mut h, code_text, &PS).block(block);
f.render_widget(Clear, area);
f.render_widget(code, area);
}

pub fn render_text<B: Backend>(f: &mut Frame<B>, title: &str, text: &str) {
pub fn render_text(f: &mut Frame, title: &str, text: &str) {
let lines: Vec<_> = text.split('\n').filter(|l| !l.is_empty()).collect();
let num_lines = lines.len();
let max_width = lines.iter().fold(0, |max, line| line.len().max(max));
Expand Down Expand Up @@ -73,8 +73,8 @@ fn get_highlighted_code<'a>(
List::new(highlighted_text)
}

fn setup_popup<'a, B: Backend>(
f: &mut Frame<B>,
fn setup_popup<'a>(
f: &mut Frame,
title: &'a str,
height_precentage: u16,
width_precentage: u16,
Expand Down

0 comments on commit f8c0a32

Please sign in to comment.