Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/tui: implement search bar for event list #19

Merged
merged 11 commits into from
May 11, 2024
14 changes: 14 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ tui-popup = "0.3.0"
thiserror = "1.0.59"
tui-scrollview = "0.3.5"
bitflags = "2.5.0"
regex = "1.10.4"
indexmap = "2.2.6"
tui-prompts = "0.3.11"
# tui-prompts = { version = "0.3.11", path = "../../contrib/tui-prompts" }
# tui-popup = { version = "0.3.0", path = "../../contrib/tui-popup" }

[dev-dependencies]
Expand Down
12 changes: 11 additions & 1 deletion src/action.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ use ratatui::layout::Size;

use crate::{
event::TracerEvent,
tui::{copy_popup::CopyPopupState, details_popup::DetailsPopupState},
tui::{
copy_popup::CopyPopupState, details_popup::DetailsPopupState, error_popup::ErrorPopupState,
query::Query,
},
};

#[derive(Debug, Clone)]
Expand Down Expand Up @@ -48,6 +51,12 @@ pub enum Action {
target: CopyTarget,
event: Arc<TracerEvent>,
},
// Query
BeginSearch,
EndSearch,
ExecuteSearch(Query),
NextMatch,
PrevMatch,
// Terminal
HandleTerminalKeyPress(KeyEvent),
}
Expand Down Expand Up @@ -77,4 +86,5 @@ pub enum ActivePopup {
Help,
ViewDetails(DetailsPopupState),
CopyTargetSelection(CopyPopupState),
ErrorPopup(ErrorPopupState),
}
6 changes: 3 additions & 3 deletions src/tracer/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ async fn run_exe_and_collect_events(
) -> Vec<TracerEvent> {
let tracer_thread = tracer.spawn(argv, None).unwrap();
tracer_thread.join().unwrap().unwrap();
let events = async {

async {
let mut events = vec![];
while let Some(event) = rx.recv().await {
events.push(event);
}
events
}
.await;
events
.await
}

#[traced_test]
Expand Down
2 changes: 2 additions & 0 deletions src/tui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ use crate::event::{Event, TracerEvent};
pub mod app;
pub mod copy_popup;
pub mod details_popup;
pub mod error_popup;
mod event_list;
pub mod help;
mod partial_line;
mod pseudo_term;
pub mod query;
mod sized_paragraph;
pub mod theme;
mod ui;
Expand Down
Loading