Pass focus cmd through, fix search keybinding

This commit is contained in:
KoffeinFlummi
2019-03-31 21:33:32 +02:00
parent 3f57111b7e
commit 626ee79654
2 changed files with 15 additions and 0 deletions

View File

@@ -266,6 +266,8 @@ impl ViewExt for Layout {
if let Some(view) = args.get(0) {
if self.views.keys().any(|k| k == view) {
self.set_view(view.clone());
let screen = self.views.get_mut(view).unwrap();
screen.view.on_command(s, cmd, args)?;
}
}

View File

@@ -51,6 +51,13 @@ impl SearchView {
}
}
pub fn clear(&mut self) {
self.edit
.call_on(&Selector::Id(EDIT_ID), |v: &mut EditView| {
v.set_content("");
});
}
pub fn run_search<S: Into<String>>(&mut self, query: S) {
let query = query.into();
let q = query.clone();
@@ -130,6 +137,12 @@ impl ViewExt for SearchView {
return Ok(CommandResult::Consumed(None));
}
if cmd == "focus" {
self.edit_focused = true;
self.clear();
return Ok(CommandResult::Consumed(None));
}
let result = if !self.edit_focused {
self.list.on_command(s, cmd, args)?
} else {