mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Move-to-first-character-of-line no longer explodes on empty lines
This commit is contained in:
@@ -427,6 +427,10 @@ describe "Editor", ->
|
||||
expect(cursor1.getBufferPosition()).toEqual [0,0]
|
||||
expect(cursor2.getBufferPosition()).toEqual [1,0]
|
||||
|
||||
it "does not throw an exception on an empty line", ->
|
||||
editor.setCursorBufferPosition([10, 0])
|
||||
editor.trigger 'move-to-first-character-of-line'
|
||||
|
||||
describe "move-to-next-word", ->
|
||||
it "moves the cursor to the next word or the end of file if there is no next word", ->
|
||||
editor.setCursorBufferPosition [2, 5]
|
||||
|
||||
@@ -144,6 +144,7 @@ class Cursor extends View
|
||||
newPosition = null
|
||||
@editor.scanInRange /^\s*/, range, (match, matchRange) =>
|
||||
newPosition = matchRange.end
|
||||
return unless newPosition
|
||||
newPosition = [position.row, 0] if newPosition.isEqual(position)
|
||||
@setBufferPosition(newPosition)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user