diff --git a/spec/atom/command-interpreter-spec.coffee b/spec/atom/command-interpreter-spec.coffee index 9c30546e8..0b39d430b 100644 --- a/spec/atom/command-interpreter-spec.coffee +++ b/spec/atom/command-interpreter-spec.coffee @@ -10,6 +10,11 @@ describe "CommandInterpreter", -> editor = new Editor({buffer}) interpreter = new CommandInterpreter() + describe "addresses", -> + it "selects the given lines", -> + interpreter.eval(editor, '4,7') + expect(editor.selection.getBufferRange()).toEqual [[3, 0], [6, 0]] + describe "substitution", -> it "does nothing if there are no matches", -> editor.selection.setBufferRange([[6, 0], [6, 44]]) diff --git a/src/atom/commands.pegjs b/src/atom/commands.pegjs index 2c85a647f..74f52b110 100644 --- a/src/atom/commands.pegjs +++ b/src/atom/commands.pegjs @@ -4,10 +4,10 @@ } start - = address:address? _ command:substitution { + = address:address? _ command:substitution? { var operations = []; if (address) operations.push(address); - operations.push(command); + if (command) operations.push(command); return operations; }