mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Add isOnEOL method to cursor
This commit is contained in:
@@ -35,3 +35,11 @@ describe "Cursor", ->
|
||||
advanceClock(100)
|
||||
expect(cursor).toHaveClass 'idle'
|
||||
|
||||
describe ".isOnEOL()", ->
|
||||
it "only returns true when cursor is on the end of a line", ->
|
||||
cursor.setPosition([1,29])
|
||||
expect(cursor.isOnEOL()).toBeFalsy()
|
||||
|
||||
cursor.setPosition([1,30])
|
||||
expect(cursor.isOnEOL()).toBeTruthy()
|
||||
|
||||
|
||||
@@ -38,6 +38,9 @@ class Cursor extends View
|
||||
getRow: ->
|
||||
@getPosition().row
|
||||
|
||||
isOnEOL: ->
|
||||
@getColumn() == @editor.getCurrentLine().length
|
||||
|
||||
moveUp: ->
|
||||
{ row, column } = @getPosition()
|
||||
column = @goalColumn if @goalColumn?
|
||||
|
||||
Reference in New Issue
Block a user