Skip to content

Commit

Permalink
Deprecate Editor::lineLengthForBufferRow
Browse files Browse the repository at this point in the history
  • Loading branch information
benogle committed Sep 3, 2014
1 parent 0703788 commit 5e21d1c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion benchmark/benchmark-suite.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ describe "editorView.", ->
benchmark "cache-entire-visible-area", 100, ->
for i in [firstRow..lastRow]
line = editorView.lineElementForScreenRow(i)[0]
editorView.positionLeftForLineAndColumn(line, i, Math.max(0, editorView.lineLengthForBufferRow(i)))
editorView.positionLeftForLineAndColumn(line, i, Math.max(0, editorView.getModel().lineTextForBufferRow(i).length))

describe "text-rendering.", ->
beforeEach ->
Expand Down
6 changes: 4 additions & 2 deletions src/editor.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,13 @@ class Editor extends Model
deprecate "Use Editor::tokenizedLinesForScreenRows instead"
@tokenizedLinesForScreenRows(start, end)

# Public: Returns a {Number} representing the line length for the given
# Returns a {Number} representing the line length for the given
# buffer row, exclusive of its line-ending character(s).
#
# * `row` A {Number} indicating the buffer row.
lineLengthForBufferRow: (row) -> @buffer.lineLengthForRow(row)
lineLengthForBufferRow: (row) ->
deprecate "Use editor.lineTextForBufferRow(row).length instead"
@lineTextForBufferRow(row).length

bufferRowForScreenRow: (row) -> @displayBuffer.bufferRowForScreenRow(row)

Expand Down
2 changes: 1 addition & 1 deletion src/language-mode.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class LanguageMode
break unless /\w/.test(@editor.lineTextForBufferRow(endRow + 1))
endRow++

new Range([startRow, 0], [endRow, @editor.lineLengthForBufferRow(endRow)])
new Range([startRow, 0], [endRow, @editor.lineTextForBufferRow(endRow).length])

# Given a buffer row, this returns a suggested indentation level.
#
Expand Down

0 comments on commit 5e21d1c

Please sign in to comment.