x command loops over all selected regions

This commit is contained in:
Corey Johnson & Nathan Sobo
2012-03-27 14:32:20 -07:00
parent ad3aa0709c
commit 7d969e145a
6 changed files with 42 additions and 14 deletions

View File

@@ -90,6 +90,20 @@ describe "CommandInterpreter", ->
expect(selections[2].getBufferRange()).toEqual [[6,34], [6,41]]
expect(selections[3].getBufferRange()).toEqual [[6,56], [6,63]]
it "loops through current selections and selects text matching the regex", ->
editor.setSelectionBufferRange [[3,0], [3,62]]
editor.addSelectionForBufferRange [[6,0], [6,65]]
interpreter.eval(editor, 'x/current')
selections = editor.getSelections()
expect(selections.length).toBe 4
expect(selections[0].getBufferRange()).toEqual [[3,31], [3,38]]
expect(selections[1].getBufferRange()).toEqual [[6,6], [6,13]]
expect(selections[2].getBufferRange()).toEqual [[6,34], [6,41]]
expect(selections[3].getBufferRange()).toEqual [[6,56], [6,63]]
describe "substitution", ->
it "does nothing if there are no matches", ->
editor.getSelection().setBufferRange([[6, 0], [6, 44]])