Pass focus cmd through, fix search keybinding
This commit is contained in:
@@ -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)?;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user