Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Deprecate obvious EditorView methods #3457

Merged
merged 7 commits into from
Sep 4, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Deprecate EditorView::getFirstVisibleScreenRow
  • Loading branch information
benogle committed Sep 4, 2014
commit dc21e8707f54de77fb0f4459df897c5dace95247
8 changes: 4 additions & 4 deletions benchmark/benchmark-suite.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ describe "editorView.", ->
describe "empty-vs-set-innerHTML.", ->
[firstRow, lastRow] = []
beforeEach ->
firstRow = editorView.getFirstVisibleScreenRow()
lastRow = editorView.getLastVisibleScreenRow()
firstRow = editorView.getModel().getFirstVisibleScreenRow()
lastRow = editorView.getModel().getLastVisibleScreenRow()

benchmark "build-gutter-html.", 1000, ->
editorView.gutter.renderLineNumbers(null, firstRow, lastRow)
Expand Down Expand Up @@ -97,8 +97,8 @@ describe "editorView.", ->
describe "multiple-lines.", ->
[firstRow, lastRow] = []
beforeEach ->
firstRow = editorView.getFirstVisibleScreenRow()
lastRow = editorView.getLastVisibleScreenRow()
firstRow = editorView.getModel().getFirstVisibleScreenRow()
lastRow = editorView.getModel().getLastVisibleScreenRow()

benchmark "cache-entire-visible-area", 100, ->
for i in [firstRow..lastRow]
Expand Down
14 changes: 4 additions & 10 deletions src/editor-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -256,19 +256,13 @@ class EditorView extends View
deprecate('Use editorView.getModel().pageUp()')
@editor.pageUp()

# Public: Retrieves the number of the row that is visible and currently at the
# top of the editor.
#
# Returns a {Number}.
getFirstVisibleScreenRow: ->
@editor.getVisibleRowRange()[0]
deprecate 'Use Editor::getFirstVisibleScreenRow instead. You can get the editor via editorView.getModel()'
@editor.getFirstVisibleScreenRow()

# Public: Retrieves the number of the row that is visible and currently at the
# bottom of the editor.
#
# Returns a {Number}.
getLastVisibleScreenRow: ->
@editor.getVisibleRowRange()[1]
deprecate 'Use Editor::getLastVisibleScreenRow instead. You can get the editor via editorView.getModel()'
@editor.getLastVisibleScreenRow()

# Public: Gets the font family for the editor.
#
Expand Down
16 changes: 15 additions & 1 deletion src/editor.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2396,7 +2396,21 @@ class Editor extends Model
Section: Editor Rendering
###

# Public: Converts a buffer position to a pixel position.
# Extended: Retrieves the number of the row that is visible and currently at the
# top of the editor.
#
# Returns a {Number}.
getFirstVisibleScreenRow: ->
@getVisibleRowRange()[0]

# Extended: Retrieves the number of the row that is visible and currently at the
# bottom of the editor.
#
# Returns a {Number}.
getLastVisibleScreenRow: ->
@getVisibleRowRange()[1]

# Extended: Converts a buffer position to a pixel position.
#
# * `bufferPosition` An object that represents a buffer position. It can be either
# an {Object} (`{row, column}`), {Array} (`[row, column]`), or {Point}
Expand Down