x/$/ places cursors at end of lines in current selection

Editor addSelectionForBufferRange no longer attempts to recycle an existing empty selection, because this was interfering with x selecting zero-width matches. It always adds a new selection, and tools must take care to use it correctly.
This commit is contained in:
Nathan Sobo
2012-03-29 11:46:56 -07:00
parent 9ba88959bb
commit fc76bed81e
3 changed files with 14 additions and 7 deletions

View File

@@ -15,4 +15,5 @@ class SelectAllMatches extends Command
rangesToSelect.push(range)
editor.clearSelections()
editor.addSelectionForBufferRange(range) for range in rangesToSelect
editor.setSelectionBufferRange(rangesToSelect[0])
editor.addSelectionForBufferRange(range) for range in rangesToSelect[1..]

View File

@@ -30,12 +30,7 @@ class CompositeSeleciton
@editor.lines.append(selection)
addSelectionForBufferRange: (bufferRange, options) ->
selections = @getSelections()
cursor = if selections.length == 1 and selections[0].isEmpty()
selections[0].cursor
else
@editor.compositeCursor.addCursor()
cursor = @editor.compositeCursor.addCursor()
@selectionForCursor(cursor).setBufferRange(bufferRange, options)
removeSelectionForCursor: (cursor) ->