Rename EditSession.scanInRange to scanInBufferRange

This is more consistent with other range-oriented methods on
EditSession. At this layer, we need to be explicit about what kind
of range we are talking about.
This commit is contained in:
Nathan Sobo
2013-04-03 11:28:55 -06:00
parent 59a5a5bc8f
commit 5df78812ef
3 changed files with 9 additions and 9 deletions

View File

@@ -135,7 +135,7 @@ class Cursor
position = @getBufferPosition()
scanRange = @getCurrentLineBufferRange()
newPosition = null
@editSession.scanInRange /^\s*/, scanRange, ({range}) =>
@editSession.scanInBufferRange /^\s*/, scanRange, ({range}) =>
newPosition = range.end
return unless newPosition
newPosition = [position.row, 0] if newPosition.isEqual(position)
@@ -145,7 +145,7 @@ class Cursor
position = @getBufferPosition()
scanRange = @getCurrentLineBufferRange()
endOfLeadingWhitespace = null
@editSession.scanInRange /^[ \t]*/, scanRange, ({range}) =>
@editSession.scanInBufferRange /^[ \t]*/, scanRange, ({range}) =>
endOfLeadingWhitespace = range.end
@setBufferPosition(endOfLeadingWhitespace) if endOfLeadingWhitespace.isGreaterThan(position)
@@ -167,7 +167,7 @@ class Cursor
scanRange = [[previousNonBlankRow, 0], currentBufferPosition]
beginningOfWordPosition = null
@editSession.backwardsScanInRange (options.wordRegex ? @wordRegExp()), scanRange, ({range, stop}) =>
@editSession.backwardsScanInBufferRange (options.wordRegex ? @wordRegExp()), scanRange, ({range, stop}) =>
if range.end.isGreaterThanOrEqual(currentBufferPosition) or allowPrevious
beginningOfWordPosition = range.start
if not beginningOfWordPosition?.isEqual(currentBufferPosition)
@@ -181,7 +181,7 @@ class Cursor
scanRange = [currentBufferPosition, @editSession.getEofBufferPosition()]
endOfWordPosition = null
@editSession.scanInRange (options.wordRegex ? @wordRegExp()), scanRange, ({range, stop}) =>
@editSession.scanInBufferRange (options.wordRegex ? @wordRegExp()), scanRange, ({range, stop}) =>
if range.start.isLessThanOrEqual(currentBufferPosition) or allowNext
endOfWordPosition = range.end
if not endOfWordPosition?.isEqual(currentBufferPosition)

View File

@@ -163,8 +163,8 @@ class EditSession
bufferRangeForBufferRow: (row, options) -> @buffer.rangeForRow(row, options)
lineForBufferRow: (row) -> @buffer.lineForRow(row)
lineLengthForBufferRow: (row) -> @buffer.lineLengthForRow(row)
scanInRange: (args...) -> @buffer.scanInRange(args...)
backwardsScanInRange: (args...) -> @buffer.backwardsScanInRange(args...)
scanInBufferRange: (args...) -> @buffer.scanInRange(args...)
backwardsScanInBufferRange: (args...) -> @buffer.backwardsScanInRange(args...)
isModified: -> @buffer.isModified()
hasEditors: -> @buffer.hasEditors()
@@ -245,7 +245,7 @@ class EditSession
normalizeTabsInBufferRange: (bufferRange) ->
return unless @softTabs
@scanInRange /\t/, bufferRange, ({replace}) => replace(@getTabText())
@scanInBufferRange /\t/, bufferRange, ({replace}) => replace(@getTabText())
cutToEndOfLine: ->
maintainPasteboard = false

View File

@@ -315,8 +315,8 @@ class Editor extends View
lineForBufferRow: (row) -> @getBuffer().lineForRow(row)
lineLengthForBufferRow: (row) -> @getBuffer().lineLengthForRow(row)
rangeForBufferRow: (row) -> @getBuffer().rangeForRow(row)
scanInRange: (args...) -> @getBuffer().scanInRange(args...)
backwardsScanInRange: (args...) -> @getBuffer().backwardsScanInRange(args...)
scanInBufferRange: (args...) -> @getBuffer().scanInRange(args...)
backwardsScanInBufferRange: (args...) -> @getBuffer().backwardsScanInRange(args...)
configure: ->
@observeConfig 'editor.showLineNumbers', (showLineNumbers) => @gutter.setShowLineNumbers(showLineNumbers)