mirror of
https://github.com/atom/atom.git
synced 2026-02-09 22:24:59 -05:00
rename buffer.lastRow() to buffer.getLastRow()
This commit is contained in:
@@ -27,7 +27,7 @@ class Buffer
|
||||
@change(@getRange(), text)
|
||||
|
||||
getRange: ->
|
||||
new Range([0, 0], [@lastRow(), @lastLine().length])
|
||||
new Range([0, 0], [@getLastRow(), @lastLine().length])
|
||||
|
||||
getTextInRange: (range) ->
|
||||
range = Range.fromObject(range)
|
||||
@@ -54,11 +54,11 @@ class Buffer
|
||||
numLines: ->
|
||||
@getLines().length
|
||||
|
||||
lastRow: ->
|
||||
getLastRow: ->
|
||||
@getLines().length - 1
|
||||
|
||||
lastLine: ->
|
||||
@lineForRow(@lastRow())
|
||||
@lineForRow(@getLastRow())
|
||||
|
||||
characterIndexForPosition: (position) ->
|
||||
position = Point.fromObject(position)
|
||||
@@ -77,7 +77,7 @@ class Buffer
|
||||
|
||||
deleteRow: (row) ->
|
||||
range = null
|
||||
if row == @lastRow()
|
||||
if row == @getLastRow()
|
||||
range = new Range([row - 1, @getLineLength(row - 1)], [row, @getLineLength(row)])
|
||||
else
|
||||
range = new Range([row, 0], [row + 1, 0])
|
||||
|
||||
@@ -372,7 +372,7 @@ class Editor extends View
|
||||
|
||||
setText: (text) -> @buffer.setText(text)
|
||||
getText: -> @buffer.getText()
|
||||
getLastBufferRow: -> @buffer.lastRow()
|
||||
getLastBufferRow: -> @buffer.getLastRow()
|
||||
getBufferLineLength: (row) -> @buffer.getLineLength(row)
|
||||
|
||||
insertText: (text) ->
|
||||
|
||||
@@ -10,7 +10,7 @@ class Highlighter
|
||||
|
||||
constructor: (@buffer) ->
|
||||
@id = @constructor.idCounter++
|
||||
@screenLines = @buildLinesForScreenRows('start', 0, @buffer.lastRow())
|
||||
@screenLines = @buildLinesForScreenRows('start', 0, @buffer.getLastRow())
|
||||
@buffer.on "change.highlighter#{@id}", (e) => @handleBufferChange(e)
|
||||
|
||||
handleBufferChange: (e) ->
|
||||
@@ -27,7 +27,7 @@ class Highlighter
|
||||
# if it differs, re-tokenize the next line with the new state and repeat for
|
||||
# each line until the line's new state matches the previous state. this covers
|
||||
# cases like inserting a /* needing to comment out lines below until we see a */
|
||||
for row in [newRange.end.row...@buffer.lastRow()]
|
||||
for row in [newRange.end.row...@buffer.getLastRow()]
|
||||
break if @screenLines[row].state == previousState
|
||||
nextRow = row + 1
|
||||
previousState = @screenLines[nextRow].state
|
||||
@@ -66,9 +66,6 @@ class Highlighter
|
||||
linesForScreenRows: (startRow, endRow) ->
|
||||
@screenLines[startRow..endRow]
|
||||
|
||||
lastRow: ->
|
||||
@screenLines.length - 1
|
||||
|
||||
destroy: ->
|
||||
@buffer.off ".highlighter#{@id}"
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class Renderer
|
||||
|
||||
buildLineMap: ->
|
||||
@lineMap = new LineMap
|
||||
@lineMap.insertAtBufferRow 0, @buildLinesForBufferRows(0, @buffer.lastRow())
|
||||
@lineMap.insertAtBufferRow 0, @buildLinesForBufferRows(0, @buffer.getLastRow())
|
||||
|
||||
setMaxLineLength: (@maxLineLength) ->
|
||||
oldRange = @rangeForAllLines()
|
||||
@@ -100,12 +100,6 @@ class Renderer
|
||||
lineCount: ->
|
||||
@lineMap.screenLineCount()
|
||||
|
||||
lastRow: ->
|
||||
@lineCount() - 1
|
||||
|
||||
logLines: ->
|
||||
@lineMap.logLines()
|
||||
|
||||
screenPositionForBufferPosition: (position) ->
|
||||
@lineMap.screenPositionForBufferPosition(position)
|
||||
|
||||
@@ -222,4 +216,7 @@ class Renderer
|
||||
@highlighter.destroy()
|
||||
@buffer.off ".renderer#{@id}"
|
||||
|
||||
logLines: ->
|
||||
@lineMap.logLines()
|
||||
|
||||
_.extend Renderer.prototype, EventEmitter
|
||||
|
||||
@@ -75,13 +75,13 @@ class MoveToNextParagraph extends Motion
|
||||
column = 0
|
||||
|
||||
startRow = @editor.getCursorBufferRow() + 1
|
||||
for r in [startRow..@editor.buffer.lastRow()]
|
||||
for r in [startRow..@editor.buffer.getLastRow()]
|
||||
if @editor.buffer.lineForRow(r).length == 0
|
||||
row = r
|
||||
break
|
||||
|
||||
if not row
|
||||
row = @editor.buffer.lastRow()
|
||||
row = @editor.buffer.getLastRow()
|
||||
column = @editor.buffer.lastLine().length - 1
|
||||
|
||||
new Point(row, column)
|
||||
|
||||
Reference in New Issue
Block a user