Merge pull request #40 from data0x200/fix-empty-command

Fix empty command cause panic
This commit is contained in:
Blaž Hrastnik 2021-06-02 13:06:57 +09:00 committed by GitHub
commit 22dad592b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1031,6 +1031,9 @@ pub fn command_mode(cx: &mut Context) {
}
let parts = input.split_ascii_whitespace().collect::<Vec<&str>>();
if parts.is_empty() {
return;
}
if let Some(cmd) = cmd::COMMANDS.get(parts[0]) {
(cmd.fun)(editor, &parts[1..], event);