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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CHANGELOG
main
----

- Filter properties with dot notation in context pane (`f`)
- Stack traversal - select stack and inspect stack frames in current mode.
- Fixed light theme.

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Prefix with number to repeat:
- `enter` toggle pane focus (full screen)
- `t` rotate the theme
- `?` Show help
- `f` Filter (context pane) - use dot notation to filter on multiple levels.

## Setting Breakpoints

Expand Down
63 changes: 41 additions & 22 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,20 +169,21 @@ impl SourceContext {
}

#[derive(Debug, Clone)]
pub enum CurrentView {
pub enum SelectedView {
Listen,
Session,
Help,
}

pub struct App {
pub is_connected: bool,
pub notification: Notification,
pub config: Config,
receiver: Receiver<AppEvent>,
quit: bool,
sender: Sender<AppEvent>,

pub is_connected: bool,
pub notification: Notification,
pub config: Config,

pub server_status: Option<ContinuationStatus>,
pub command_input: Input,
pub command_response: Option<String>,
Expand All @@ -191,7 +192,8 @@ pub struct App {

pub history: History,

pub view_current: CurrentView,
pub view_current: SelectedView,
pub focus_view: bool,
pub session_view: SessionViewState,
pub input_plurality: Vec<char>,

Expand Down Expand Up @@ -229,7 +231,8 @@ impl App {
server_status: None,
command_input: Input::default(),
command_response: None,
view_current: CurrentView::Listen,
view_current: SelectedView::Listen,
focus_view: false,
session_view: SessionViewState::new(),

snapshot_notify: Arc::new(Notify::new()),
Expand Down Expand Up @@ -401,6 +404,14 @@ impl App {
.feature_set("max_depth", self.context_depth.to_string().as_str())
.await?;
}
AppEvent::ContextFilterOpen => {
self.session_view.context_filter.show = true;
self.focus_view = true;
},
AppEvent::ContextSearchClose => {
self.session_view.context_filter.show = false;
self.focus_view = false;
},
AppEvent::ScrollSource(amount) => {
self.session_view.source_scroll = apply_scroll(
self.session_view.source_scroll,
Expand Down Expand Up @@ -440,19 +451,27 @@ impl App {
.await?;
}
AppEvent::PushInputPlurality(char) => self.input_plurality.push(char),
AppEvent::Input(key_event) => match key_event.code {
KeyCode::Char('t') => {
self.theme = self.theme.next();
self.notification =
Notification::info(format!("Switched to theme: {:?}", self.theme));
}
KeyCode::Char('?') => {
self.sender
.send(AppEvent::ChangeView(CurrentView::Help))
.await
.unwrap();
AppEvent::Input(key_event) => {
if self.focus_view {
// event shandled exclusively by view (e.g. input needs focus)
self.send_event_to_current_view(event).await;
} else {
// global events
match key_event.code {
KeyCode::Char('t') => {
self.theme = self.theme.next();
self.notification =
Notification::info(format!("Switched to theme: {:?}", self.theme));
}
KeyCode::Char('?') => {
self.sender
.send(AppEvent::ChangeView(SelectedView::Help))
.await
.unwrap();
}
_ => self.send_event_to_current_view(event).await,
}
}
_ => self.send_event_to_current_view(event).await,
},
_ => self.send_event_to_current_view(event).await,
};
Expand Down Expand Up @@ -520,9 +539,9 @@ impl App {
// route the event to the currently selected view
async fn send_event_to_current_view(&mut self, event: AppEvent) {
let subsequent_event = match self.view_current {
CurrentView::Help => HelpView::handle(self, event),
CurrentView::Listen => ListenView::handle(self, event),
CurrentView::Session => SessionView::handle(self, event),
SelectedView::Help => HelpView::handle(self, event),
SelectedView::Listen => ListenView::handle(self, event),
SelectedView::Session => SessionView::handle(self, event),
};
if let Some(event) = subsequent_event {
self.sender.send(event).await.unwrap()
Expand Down Expand Up @@ -611,7 +630,7 @@ impl App {

fn reset(&mut self) {
self.server_status = None;
self.view_current = CurrentView::Session;
self.view_current = SelectedView::Session;
self.session_view.mode = SessionViewMode::Current;
self.analyzed_files = HashMap::new();
self.workspace.reset();
Expand Down
5 changes: 3 additions & 2 deletions src/dbgp/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ pub struct ContextGetResponse {
pub properties: Vec<Property>,
}

#[derive(PartialEq, Clone, Debug)]
#[derive(PartialEq, Clone, Debug, Default)]
pub enum PropertyType {
Bool,
Int,
Float,
#[default]
String,
Null,
Array,
Expand Down Expand Up @@ -90,7 +91,7 @@ impl PropertyType {
}
}

#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Default)]
pub struct Property {
pub name: String,
pub fullname: String,
Expand Down
6 changes: 4 additions & 2 deletions src/event/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ use std::time::Duration;
use tokio::net::TcpStream;
use tokio::sync::mpsc::Sender;

use crate::app::CurrentView;
use crate::app::SelectedView;
use crate::dbgp::client::ContinuationStatus;
use crate::view::session::SessionViewMode;
use crate::view::Scroll;

#[derive(Debug)]
pub enum AppEvent {
ChangeSessionViewMode(SessionViewMode),
ChangeView(CurrentView),
ChangeView(SelectedView),
ClientConnected(TcpStream),
Disconnect,
HistoryNext,
Expand Down Expand Up @@ -47,6 +47,8 @@ pub enum AppEvent {
PushInputPlurality(char),
ContextDepth(i8),
NextTheme,
ContextFilterOpen,
ContextSearchClose,
}

pub type EventSender = Sender<AppEvent>;
Expand Down
3 changes: 3 additions & 0 deletions src/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ impl Theme {
widget_mode_history: Style::default().fg(Solarized::Red.to_color()).bg(Solarized::Base03.to_color()),

background: Style::default().bg(Color::Black),
cursor: Style::default().bg(Color::White),
},
Theme::Dark => Scheme {
syntax_variable: Style::default().fg(Color::LightBlue),
Expand Down Expand Up @@ -89,6 +90,7 @@ impl Theme {
widget_mode_debug: Style::default().bg(Color::Blue),
widget_mode_history: Style::default().bg(Color::Red),
background: Style::default().bg(Color::Black),
cursor: Style::default().bg(Color::White)
},
}
}
Expand Down Expand Up @@ -121,6 +123,7 @@ pub struct Scheme {
pub widget_inactive: Style,
pub widget_mode_debug: Style,
pub widget_mode_history: Style,
pub cursor: Style,
}

pub enum Role {}
Expand Down
Loading