mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Add EditSession.consolidateSelections()
This commit is contained in:
@@ -626,13 +626,16 @@ class EditSession
|
||||
_.remove(@selections, selection)
|
||||
|
||||
clearSelections: ->
|
||||
lastSelection = @getLastSelection()
|
||||
for selection in @getSelections() when selection != lastSelection
|
||||
selection.destroy()
|
||||
lastSelection.clear()
|
||||
@consolidateSelections()
|
||||
@getSelection().clear()
|
||||
|
||||
clearAllSelections: ->
|
||||
selection.destroy() for selection in @getSelections()
|
||||
consolidateSelections: ->
|
||||
selections = @getSelections()
|
||||
if selections.length > 1
|
||||
selection.destroy() for selection in selections[0...-1]
|
||||
true
|
||||
else
|
||||
false
|
||||
|
||||
getSelections: -> new Array(@selections...)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user