mirror of
https://github.com/atom/atom.git
synced 2026-01-25 23:08:18 -05:00
Remove last of the extraneous CursorView methods
This commit is contained in:
@@ -5,32 +5,33 @@ _ = require 'underscore'
|
||||
fs = require 'fs'
|
||||
|
||||
describe "Cursor", ->
|
||||
[buffer, editor, cursor] = []
|
||||
[buffer, editor, cursorView, cursor] = []
|
||||
|
||||
beforeEach ->
|
||||
buffer = new Buffer(require.resolve('fixtures/sample.js'))
|
||||
editor = new Editor
|
||||
editor.enableKeymap()
|
||||
editor.setBuffer(buffer)
|
||||
cursor = editor.getCursorView()
|
||||
cursor = editor.getCursor()
|
||||
cursorView = editor.getCursorView()
|
||||
|
||||
describe "adding and removing of the idle class", ->
|
||||
it "removes the idle class while moving, then adds it back when it stops", ->
|
||||
advanceClock(200)
|
||||
|
||||
expect(cursor).toHaveClass 'idle'
|
||||
expect(cursorView).toHaveClass 'idle'
|
||||
cursor.setScreenPosition([1, 2])
|
||||
expect(cursor).not.toHaveClass 'idle'
|
||||
expect(cursorView).not.toHaveClass 'idle'
|
||||
|
||||
window.advanceClock(200)
|
||||
expect(cursor).toHaveClass 'idle'
|
||||
expect(cursorView).toHaveClass 'idle'
|
||||
|
||||
cursor.setScreenPosition([1, 3])
|
||||
advanceClock(100)
|
||||
|
||||
cursor.setScreenPosition([1, 4])
|
||||
advanceClock(100)
|
||||
expect(cursor).not.toHaveClass 'idle'
|
||||
expect(cursorView).not.toHaveClass 'idle'
|
||||
|
||||
advanceClock(100)
|
||||
expect(cursor).toHaveClass 'idle'
|
||||
expect(cursorView).toHaveClass 'idle'
|
||||
|
||||
@@ -9,7 +9,6 @@ class CursorView extends View
|
||||
@content: ->
|
||||
@pre class: 'cursor idle', => @raw ' '
|
||||
|
||||
anchor: null
|
||||
editor: null
|
||||
hidden: false
|
||||
|
||||
@@ -47,23 +46,12 @@ class CursorView extends View
|
||||
@show() if @hidden
|
||||
@hidden = false
|
||||
|
||||
@getSelectionView()?.updateAppearance()
|
||||
|
||||
getSelectionView: ->
|
||||
@editor.compositeSelection.selectionViewForCursor(@cursor)
|
||||
|
||||
getBufferPosition: ->
|
||||
@cursor.getBufferPosition()
|
||||
|
||||
setBufferPosition: (bufferPosition, options={}) ->
|
||||
@cursor.setBufferPosition(bufferPosition, options)
|
||||
|
||||
getScreenPosition: ->
|
||||
@cursor.getScreenPosition()
|
||||
|
||||
setScreenPosition: (position, options={}) ->
|
||||
@cursor.setScreenPosition(position, options)
|
||||
|
||||
removeIdleClassTemporarily: ->
|
||||
@removeClass 'idle'
|
||||
window.clearTimeout(@idleTimeout) if @idleTimeout
|
||||
|
||||
@@ -155,6 +155,9 @@ class EditSession
|
||||
|
||||
getCursors: -> new Array(@cursors...)
|
||||
|
||||
getCursor: (index=0) ->
|
||||
@cursors[index]
|
||||
|
||||
getLastCursor: ->
|
||||
_.last(@cursors)
|
||||
|
||||
|
||||
@@ -653,6 +653,7 @@ class Editor extends View
|
||||
getCursorView: (index) -> @compositeCursor.getCursorView(index)
|
||||
getCursorViews: -> @compositeCursor.getCursorViews()
|
||||
removeAllCursorViews: -> @compositeCursor.removeAllCursorViews()
|
||||
getCursor: (index) -> @activeEditSession.getCursor(index)
|
||||
getCursors: -> @activeEditSession.getCursors()
|
||||
getLastCursor: -> @activeEditSession.getLastCursor()
|
||||
moveCursorUp: -> @activeEditSession.moveCursorUp()
|
||||
|
||||
Reference in New Issue
Block a user