mirror of
https://github.com/atom/atom.git
synced 2026-02-14 00:25:08 -05:00
cursor.getBeginningOfCurrentWordBufferPosition behaves like vim
This commit is contained in:
@@ -149,10 +149,14 @@ class Cursor
|
||||
previousLinesRange = [[previousNonBlankRow, 0], currentBufferPosition]
|
||||
|
||||
beginningOfWordPosition = currentBufferPosition
|
||||
@editSession.backwardsScanInRange (options.wordRegex ? config.get("editor.wordRegex")), previousLinesRange, (match, matchRange, { stop }) =>
|
||||
|
||||
wordSeparators = config.get("editor.wordSeparators")
|
||||
wordSeparatorsRegex = new RegExp("^[\t ]*\n|[^\\s#{_.escapeRegExp(wordSeparators)}]+|[#{_.escapeRegExp(wordSeparators)}]+", "m")
|
||||
@editSession.backwardsScanInRange (options.wordRegex ? wordSeparatorsRegex), previousLinesRange, (match, matchRange, { stop }) =>
|
||||
if matchRange.end.isGreaterThanOrEqual(currentBufferPosition) or allowPrevious
|
||||
beginningOfWordPosition = matchRange.start
|
||||
stop()
|
||||
|
||||
beginningOfWordPosition
|
||||
|
||||
getEndOfCurrentWordBufferPosition: (options = {}) ->
|
||||
|
||||
@@ -20,6 +20,7 @@ class Editor extends View
|
||||
autoIndent: true
|
||||
autoIndentOnPaste: false
|
||||
wordRegex: /(\w+)|([^\w\n]+)/g
|
||||
wordSeparators: "./\()\"’-:,.;<>~!@#$%^&*|+=[]{}`~?"
|
||||
|
||||
@content: (params) ->
|
||||
@div class: @classes(params), tabindex: -1, =>
|
||||
|
||||
Reference in New Issue
Block a user