Skip to content

Commit

Permalink
Rename EditSession.scanInRange to scanInBufferRange
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Nathan Sobo committed Apr 3, 2013
1 parent 59a5a5b commit 5df7881
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/app/cursor.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/app/edit-session.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/app/editor.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5df7881

Please sign in to comment.