Move getFirst/LastVisibleScreenRow to the view

This commit is contained in:
Nathan Sobo
2015-01-14 20:02:49 -07:00
parent 49699bddf2
commit 5a4cf01083
3 changed files with 22 additions and 12 deletions

View File

@@ -190,6 +190,20 @@ class TextEditorElement extends HTMLElement
pixelPositionForScreenPosition: (screenPosition) ->
@getModel().pixelPositionForScreenPosition(screenPosition, true)
# Extended: Retrieves the number of the row that is visible and currently at the
# top of the editor.
#
# Returns a {Number}.
getFirstVisibleScreenRow: ->
@getModel().getFirstVisibleScreenRow(true)
# Extended: Retrieves the number of the row that is visible and currently at the
# bottom of the editor.
#
# Returns a {Number}.
getLastVisibleScreenRow: ->
@getModel().getLastVisibleScreenRow(true)
# Extended: call the given `callback` when the editor is attached to the DOM.
#
# * `callback` {Function}

View File

@@ -251,8 +251,8 @@ class TextEditorView extends View
@model.pageUp()
getFirstVisibleScreenRow: ->
deprecate 'Use TextEditor::getFirstVisibleScreenRow instead. You can get the editor via editorView.getModel()'
@model.getFirstVisibleScreenRow()
deprecate 'Use TextEditorElement::getFirstVisibleScreenRow instead.'
@model.getFirstVisibleScreenRow(true)
getLastVisibleScreenRow: ->
deprecate 'Use TextEditor::getLastVisibleScreenRow instead. You can get the editor via editorView.getModel()'

View File

@@ -2885,18 +2885,14 @@ class TextEditor extends Model
@placeholderText = placeholderText
@emitter.emit 'did-change-placeholder-text', @placeholderText
# Extended: Retrieves the number of the row that is visible and currently at the
# top of the editor.
#
# Returns a {Number}.
getFirstVisibleScreenRow: ->
getFirstVisibleScreenRow: (suppressDeprecation) ->
unless suppressDeprecation
deprecate("This is now a view method. Call TextEditorElement::getFirstVisibleScreenRow instead.")
@getVisibleRowRange()[0]
# Extended: Retrieves the number of the row that is visible and currently at the
# bottom of the editor.
#
# Returns a {Number}.
getLastVisibleScreenRow: ->
getLastVisibleScreenRow: (suppressDeprecation) ->
unless suppressDeprecation
deprecate("This is now a view method. Call TextEditorElement::getLastVisibleScreenRow instead.")
@getVisibleRowRange()[1]
pixelPositionForBufferPosition: (bufferPosition, suppressDeprecation) ->