mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
selection.selectWord will consider whitespace a word
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user