diff --git a/src/text-editor-element.coffee b/src/text-editor-element.coffee index 38b980b65..67e62b408 100644 --- a/src/text-editor-element.coffee +++ b/src/text-editor-element.coffee @@ -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} diff --git a/src/text-editor-view.coffee b/src/text-editor-view.coffee index bcd0dcfb1..bdba5bdfc 100644 --- a/src/text-editor-view.coffee +++ b/src/text-editor-view.coffee @@ -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()' diff --git a/src/text-editor.coffee b/src/text-editor.coffee index f69243da1..3ba16f210 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -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) ->