selection.selectWord will consider whitespace a word

This commit is contained in:
Corey Johnson
2013-01-29 16:33:06 -08:00
parent dac92ca6e7
commit 8973a66cfe
2 changed files with 9 additions and 1 deletions

View File

@@ -58,6 +58,11 @@ class Cursor
isLastCursor: ->
this == @editSession.getCursor()
isSurroundedByWhitespace: ->
{row, column} = @getBufferPosition()
range = [[row, column + 1], [row, Math.max(0, column - 1)]]
/^\s+$/.test @editSession.getTextInBufferRange(range)
autoscrolled: ->
@needsAutoscroll = false

View File

@@ -96,7 +96,10 @@ class Selection
@screenRangeChanged()
selectWord: ->
@setBufferRange(@cursor.getCurrentWordBufferRange())
options = {}
options.wordRegex = /[\t ]*/ if @cursor.isSurroundedByWhitespace()
@setBufferRange(@cursor.getCurrentWordBufferRange(options))
@wordwise = true
@initialScreenRange = @getScreenRange()