diff --git a/README.md b/README.md index b205163..0bb91f4 100644 --- a/README.md +++ b/README.md @@ -144,9 +144,9 @@ are supported: * a | asc | ascending * d | desc | descending -The screens can be opened with `queue`, `search`, `playlists` and `log`, whereas -`search` can be supplied with a search term that will be entered after opening -the search view. +The screens can be opened with `focus `. +The `search` command can be supplied with a search term that will be +entered after opening the search view. To close the commandprompt at any time, press `esc`. diff --git a/src/command.rs b/src/command.rs index 928117d..ab2e8c9 100644 --- a/src/command.rs +++ b/src/command.rs @@ -258,9 +258,7 @@ pub fn parse(input: &str) -> Option { }) .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()); diff --git a/src/commands.rs b/src/commands.rs index b232b60..fa8d2ff 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -195,8 +195,7 @@ impl CommandManager { } Ok(None) } - Command::Search(_) - | Command::Jump(_) + Command::Jump(_) | Command::Move(_, _) | Command::Shift(_, _) | Command::Play diff --git a/src/ui/layout.rs b/src/ui/layout.rs index b4ffbff..e68fdbc 100644 --- a/src/ui/layout.rs +++ b/src/ui/layout.rs @@ -293,6 +293,12 @@ impl View for Layout { impl ViewExt for Layout { fn on_command(&mut self, s: &mut Cursive, cmd: &Command) -> Result { 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());