mirror of
https://github.com/atom/atom.git
synced 2026-02-09 22:24:59 -05:00
Cover other next word cases.
Now it moves to words on the next line and also to the next empty line.
This commit is contained in:
@@ -61,8 +61,8 @@ class Editor extends Template
|
||||
getCursor: ->
|
||||
@getAceSession().getSelection().getCursor()
|
||||
|
||||
getLineText: ->
|
||||
@buffer.getLine(@getRow())
|
||||
getLineText: (row) ->
|
||||
@buffer.getLine(row)
|
||||
|
||||
getRow: ->
|
||||
{ row } = @getCursor()
|
||||
|
||||
@@ -54,12 +54,17 @@ module.exports =
|
||||
execute: (editor) ->
|
||||
regex = getWordRegex()
|
||||
{ row, column } = editor.getCursor()
|
||||
rightOfCursor = editor.getLineText().substring(column)
|
||||
rightOfCursor = editor.getLineText(row).substring(column)
|
||||
|
||||
match = regex.exec(rightOfCursor)
|
||||
# If we're on top of part of a word, match the next one.
|
||||
match = regex.exec(rightOfCursor) if match?.index is 0
|
||||
column += match.index
|
||||
|
||||
if match
|
||||
column += match.index
|
||||
else
|
||||
nextLineMatch = regex.exec(editor.getLineText(++row))
|
||||
column = nextLineMatch?.index or 0
|
||||
|
||||
editor.setCursor { row, column }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user