Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/actionlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: actionlint

on:
pull_request:

jobs:
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6
with:
show-progress: false
sparse-checkout: '.github/'

- uses: docker://index.docker.io/rhysd/actionlint@sha256:b1934ee5f1c509618f2508e6eb47ee0d3520686341fec936f3b79331f9315667 # ratchet:docker://rhysd/actionlint:1.7.12
with:
args: -color
18 changes: 18 additions & 0 deletions .github/workflows/ratchet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: ratchet

on:
pull_request:

jobs:
ratchet:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6
with:
show-progress: false
sparse-checkout: '.github/'

- name: ratchet
uses: sethvargo/ratchet@27f7515b4648e179168f8f8ae2257636fdb03c48 # ratchet:sethvargo/ratchet@main
with:
files: .github/workflows/*.yml
64 changes: 64 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: rust

on:
pull_request:

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6
with:
show-progress: false

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # ratchet:dtolnay/rust-toolchain@stable

- name: cargo build
run: cargo build --workspace --verbose

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6
with:
show-progress: false

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # ratchet:dtolnay/rust-toolchain@stable

- name: cargo test
run: cargo test --workspace --verbose

clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6
with:
show-progress: false

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # ratchet:dtolnay/rust-toolchain@stable
with:
components: clippy

- name: cargo clippy
run: cargo clippy --workspace --all-targets --all-features -- -D warnings

fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # ratchet:actions/checkout@v6
with:
show-progress: false

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # ratchet:dtolnay/rust-toolchain@stable
with:
components: rustfmt

- name: cargo fmt
run: cargo fmt --all -- --check
37 changes: 17 additions & 20 deletions rutt-tui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,27 +63,24 @@ async fn run_app<B: ratatui::backend::Backend>(
ui(f, state);
})?;

if event::poll(std::time::Duration::from_millis(16))? {
if let Event::Key(key) = event::read()? {
if key.kind == KeyEventKind::Press {
let action = match key.code {
KeyCode::Char('q') => Some(Action::Quit),
KeyCode::Char('k') | KeyCode::Up => Some(Action::MoveUp),
KeyCode::Char('j') | KeyCode::Down => Some(Action::MoveDown),
KeyCode::Enter | KeyCode::Char('l') | KeyCode::Right => Some(Action::Enter),
KeyCode::Backspace | KeyCode::Char('h') | KeyCode::Left => {
Some(Action::Back)
}
_ => None,
};

if let Some(action) = action {
if action == Action::Quit {
return Ok(());
}
state.handle_action(action, visible_height);
}
if event::poll(std::time::Duration::from_millis(16))?
&& let Event::Key(key) = event::read()?
&& key.kind == KeyEventKind::Press
{
let action = match key.code {
KeyCode::Char('q') => Some(Action::Quit),
KeyCode::Char('k') | KeyCode::Up => Some(Action::MoveUp),
KeyCode::Char('j') | KeyCode::Down => Some(Action::MoveDown),
KeyCode::Enter | KeyCode::Char('l') | KeyCode::Right => Some(Action::Enter),
KeyCode::Backspace | KeyCode::Char('h') | KeyCode::Left => Some(Action::Back),
_ => None,
};

if let Some(action) = action {
if action == Action::Quit {
return Ok(());
}
state.handle_action(action, visible_height);
}
}
Comment thread
denversc marked this conversation as resolved.
}
Expand Down