mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Move moveLeft/Right/ToTop/ToBottom methods into cursor model
This commit is contained in:
@@ -46,6 +46,21 @@ class Cursor
|
||||
@setScreenPosition({row: row + 1, column: column})
|
||||
@goalColumn = column
|
||||
|
||||
moveLeft: ->
|
||||
{ row, column } = @getScreenPosition()
|
||||
[row, column] = if column > 0 then [row, column - 1] else [row - 1, Infinity]
|
||||
@setScreenPosition({row, column})
|
||||
|
||||
moveRight: ->
|
||||
{ row, column } = @getScreenPosition()
|
||||
@setScreenPosition([row, column + 1], skipAtomicTokens: true, wrapBeyondNewlines: true, wrapAtSoftNewlines: true)
|
||||
|
||||
moveToTop: ->
|
||||
@setBufferPosition([0,0])
|
||||
|
||||
moveToBottom: ->
|
||||
@setBufferPosition(@editSession.getEofBufferPosition())
|
||||
|
||||
destroy: ->
|
||||
@editSession.removeCursor(this)
|
||||
@trigger 'destroy'
|
||||
|
||||
Reference in New Issue
Block a user