mirror of
https://github.com/atom/atom.git
synced 2026-01-24 22:38:20 -05:00
Command interpreter can take an address by itself
This commit is contained in:
@@ -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]])
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user