@@ -258,9 +258,7 @@ pub fn parse(input: &str) -> Option<Command> {
|
||||
})
|
||||
.map(Command::Open),
|
||||
"jump" => Some(Command::Jump(JumpMode::Query(args.join(" ")))),
|
||||
"search" => args
|
||||
.get(0)
|
||||
.map(|query| Command::Search((*query).to_string())),
|
||||
"search" => Some(Command::Search(args.join(" "))),
|
||||
"shift" => {
|
||||
let amount = args.get(1).and_then(|amount| amount.parse().ok());
|
||||
|
||||
|
||||
@@ -195,8 +195,7 @@ impl CommandManager {
|
||||
}
|
||||
Ok(None)
|
||||
}
|
||||
Command::Search(_)
|
||||
| Command::Jump(_)
|
||||
Command::Jump(_)
|
||||
| Command::Move(_, _)
|
||||
| Command::Shift(_, _)
|
||||
| Command::Play
|
||||
|
||||
@@ -293,6 +293,12 @@ impl View for Layout {
|
||||
impl ViewExt for Layout {
|
||||
fn on_command(&mut self, s: &mut Cursive, cmd: &Command) -> Result<CommandResult, String> {
|
||||
match cmd {
|
||||
Command::Search(_) => {
|
||||
self.set_view("search");
|
||||
self.get_current_screen_mut()
|
||||
.map(|search| search.view.on_command(s, cmd));
|
||||
Ok(CommandResult::Consumed(None))
|
||||
}
|
||||
Command::Focus(view) => {
|
||||
if self.views.keys().any(|k| k == view) {
|
||||
self.set_view(view.clone());
|
||||
|
||||
Reference in New Issue
Block a user