Skip to content

Commit

Permalink
Fix macros
Browse files Browse the repository at this point in the history
  • Loading branch information
lusingander committed May 10, 2024
1 parent da06abf commit 810db8e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions src/macros.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
#[macro_export]
macro_rules! key_code {
( $code:path ) => {
KeyEvent { code: $code, .. }
crossterm::event::KeyEvent { code: $code, .. }
};
}

#[macro_export]
macro_rules! key_code_char {
( $c:ident ) => {
KeyEvent {
code: KeyCode::Char($c),
crossterm::event::KeyEvent {
code: crossterm::event::KeyCode::Char($c),
..
}
};
( $c:expr ) => {
KeyEvent {
code: KeyCode::Char($c),
crossterm::event::KeyEvent {
code: crossterm::event::KeyCode::Char($c),
..
}
};
( $c:expr, Ctrl ) => {
KeyEvent {
code: KeyCode::Char($c),
modifiers: KeyModifiers::CONTROL,
crossterm::event::KeyEvent {
code: crossterm::event::KeyCode::Char($c),
modifiers: crossterm::event::KeyModifiers::CONTROL,
..
}
};
Expand All @@ -33,7 +33,7 @@ macro_rules! lines {
( $($s:expr),* $(,)? ) => {
vec![
$(
Line::from($s),
ratatui::widgets::Line::from($s),
)*
]
}
Expand All @@ -45,13 +45,13 @@ macro_rules! lines_with_empty_line {
vec![
lines_with_empty_line!($s),
$(
Line::from(""),
ratatui::widgets::Line::from(""),
lines_with_empty_line!($ss),
)*
]
};

( $s:expr ) => {
Line::from($s)
ratatui::widgets::Line::from($s)
};
}
2 changes: 1 addition & 1 deletion src/run.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
use crossterm::event::KeyCode;
use ratatui::{backend::Backend, Terminal};
use std::io::Result;

Expand Down

0 comments on commit 810db8e

Please sign in to comment.