Only change end position if selection is mult-line

This commit is contained in:
Kevin Sawicki
2013-01-23 16:46:43 -08:00
parent 6324a60d72
commit 7425f58f26
2 changed files with 18 additions and 3 deletions

View File

@@ -74,8 +74,12 @@ class LanguageMode
options = reverse: selection.isReversed()
wrappedText = "#{bracket}#{selection.getText()}#{pair}"
selection.insertText(wrappedText)
newRange = [range.start.add([0, 1]), range.end.add([0, 1])]
selection.setBufferRange(newRange, options)
selectionStart = range.start.add([0, 1])
if range.start.row is range.end.row
selectionEnd = range.end.add([0, 1])
else
selectionEnd = range.end
selection.setBufferRange([selectionStart, selectionEnd], options)
reloadGrammar: ->
path = @buffer.getPath()