Don't create folds for empty ranges

This commit is contained in:
Antonio Scandurra
2016-04-28 13:43:00 +02:00
parent 57442781ec
commit f2a497d591
2 changed files with 22 additions and 2 deletions

View File

@@ -628,8 +628,9 @@ class Selection extends Model
# Public: Creates a fold containing the current selection.
fold: ->
range = @getBufferRange()
@editor.foldBufferRange(range)
@cursor.setBufferPosition(range.end)
unless range.isEmpty()
@editor.foldBufferRange(range)
@cursor.setBufferPosition(range.end)
# Private: Increase the indentation level of the given text by given number
# of levels. Leaves the first line unchanged.