diff --git a/benchmark/benchmark-suite.coffee b/benchmark/benchmark-suite.coffee index 2984c007e..c60811985 100644 --- a/benchmark/benchmark-suite.coffee +++ b/benchmark/benchmark-suite.coffee @@ -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 -> diff --git a/src/editor.coffee b/src/editor.coffee index 7f78610cb..8ce5c6de4 100644 --- a/src/editor.coffee +++ b/src/editor.coffee @@ -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) diff --git a/src/language-mode.coffee b/src/language-mode.coffee index b224fd631..de1a5b928 100644 --- a/src/language-mode.coffee +++ b/src/language-mode.coffee @@ -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. #