summaryrefslogtreecommitdiffstats
path: root/src/stage
diff options
context:
space:
mode:
authorCanop <cano.petrole@gmail.com>2021-04-20 07:39:41 +0200
committerCanop <cano.petrole@gmail.com>2021-04-20 07:39:41 +0200
commit040c173bb47bf3ac4e97fbca0b7a8adba5051642 (patch)
tree90081bed5b0479ee9ae22d792815cd7acb488c32 /src/stage
parent97ce207e9e2b4928062cd2ef064f2b1a21d1e8e4 (diff)
implement with_new_options for stage_state
Diffstat (limited to 'src/stage')
-rw-r--r--src/stage/stage_state.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/stage/stage_state.rs b/src/stage/stage_state.rs
index 95da21f..fd40471 100644
--- a/src/stage/stage_state.rs
+++ b/src/stage/stage_state.rs
@@ -73,16 +73,23 @@ impl PanelState for StageState {
self.tree_options.clone()
}
+ /// option changing is unlikely to be done on this state, but
+ /// we'll still do it in case a future scenario makes it possible
+ /// to open a different state from this state
fn with_new_options(
&mut self,
- screen: Screen,
+ _screen: Screen,
change_options: &dyn Fn(&mut TreeOptions),
in_new_panel: bool,
con: &AppContext,
) -> CmdResult {
- // FIXME we must register the options, at least
- // TODO implement: sorting, etc.
- CmdResult::Keep
+ if in_new_panel {
+ CmdResult::error("stage can't be displayed in two panels")
+ } else {
+ let mut new_options= self.tree_options();
+ change_options(&mut new_options);
+ CmdResult::NewState(Box::new(StageState::new(new_options, con)))
+ }
}
fn on_pattern(