mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
cmd-left moves the cursor to column 0 on lines only containing whitespace
Fixes #1344
This commit is contained in:
@@ -432,6 +432,13 @@ describe "Editor", ->
|
||||
expect(cursor1.getBufferPosition()).toEqual [0,0]
|
||||
expect(cursor2.getBufferPosition()).toEqual [1,0]
|
||||
|
||||
it "moves to the beginning of the line if it only contains whitespace ", ->
|
||||
editor.setText("first\n \nthird")
|
||||
editor.setCursorScreenPosition [1,2]
|
||||
editor.moveCursorToFirstCharacterOfLine()
|
||||
cursor = editor.getCursor()
|
||||
expect(cursor.getBufferPosition()).toEqual [1,0]
|
||||
|
||||
describe ".moveCursorToBeginningOfWord()", ->
|
||||
it "moves the cursor to the beginning of the word", ->
|
||||
editor.setCursorBufferPosition [0, 8]
|
||||
|
||||
@@ -261,9 +261,7 @@ class Cursor
|
||||
screenline = @editor.lineForScreenRow(row)
|
||||
|
||||
goalColumn = screenline.text.search(/\S/)
|
||||
return if goalColumn == -1
|
||||
|
||||
goalColumn = 0 if goalColumn == column
|
||||
goalColumn = 0 if goalColumn == column or goalColumn == -1
|
||||
@setScreenPosition([row, goalColumn])
|
||||
|
||||
# Public: Moves the cursor to the beginning of the buffer line, skipping all
|
||||
|
||||
Reference in New Issue
Block a user