Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
Canop committed Sep 26, 2023
2 parents 938a6f7 + a898f33 commit 28163b8
Show file tree
Hide file tree
Showing 14 changed files with 659 additions and 597 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### next
- allow rebinding of the 'tab' and 'esc' keys with the `:next_match` and `:escape` internals - Fix #740
- fix fuzzy patterns not case insensitive on some characters - Fix #746
- when given a path to a file at launch, broot now selects it in the tree and opens it in preview - Fix #729

Expand Down
6 changes: 6 additions & 0 deletions src/app/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,12 @@ impl App {
HandleInApp(internal) => {
debug!("handling internal {internal:?} at app level");
match internal {
Internal::escape => {
let mode = self.panel().state().get_mode();
let cmd = self.mut_panel().input.escape(con, mode);
debug!("cmd on escape: {cmd:?}");
self.apply_command(w, cmd, panel_skin, app_state, con)?;
}
Internal::panel_left_no_open | Internal::panel_right_no_open => {
let new_active_panel_idx = if internal == Internal::panel_left_no_open {
// we're here because the state wants us to either move to the panel
Expand Down
4 changes: 2 additions & 2 deletions src/app/panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub struct Panel {
pub areas: Areas,
status: Status,
pub purpose: PanelPurpose,
input: PanelInput,
pub input: PanelInput,
}

impl Panel {
Expand Down Expand Up @@ -251,7 +251,7 @@ impl Panel {
if let Some(area) = &self.areas.purpose {
let shortcut = con
.verb_store
.verbs
.verbs()
.iter()
.filter(|v| match &v.execution {
VerbExecution::Internal(exec) => exec.internal == Internal::start_end_panel,
Expand Down
7 changes: 5 additions & 2 deletions src/app/panel_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,9 @@ pub trait PanelState {
CmdResult::Keep
}
}
Internal::escape => {
CmdResult::HandleInApp(Internal::escape)
}
Internal::panel_left | Internal::panel_left_no_open => {
CmdResult::HandleInApp(Internal::panel_left_no_open)
}
Expand Down Expand Up @@ -749,11 +752,11 @@ pub trait PanelState {
}
}
Command::VerbTrigger {
index,
verb_id,
input_invocation,
} => self.execute_verb(
w,
&con.verb_store.verbs[*index],
con.verb_store.verb(*verb_id),
input_invocation.as_ref(),
TriggerType::Other,
app_state,
Expand Down
4 changes: 2 additions & 2 deletions src/command/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use {
super::*,
crate::{
pattern::*,
verb::{Internal, VerbInvocation},
verb::{Internal, VerbInvocation, VerbId},
},
bet::BeTree,
};
Expand Down Expand Up @@ -35,7 +35,7 @@ pub enum Command {
/// call of a verb done without the input
/// (using a trigger key for example)
VerbTrigger {
index: usize,
verb_id: VerbId,
input_invocation: Option<VerbInvocation>,
},

Expand Down
Loading

0 comments on commit 28163b8

Please sign in to comment.