From 5df78812ef2c5589b765c1da952a064fdee57d72 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Wed, 3 Apr 2013 11:28:55 -0600 Subject: [PATCH] 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. --- src/app/cursor.coffee | 8 ++++---- src/app/edit-session.coffee | 6 +++--- src/app/editor.coffee | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/app/cursor.coffee b/src/app/cursor.coffee index f12a78c65..8f1a21d67 100644 --- a/src/app/cursor.coffee +++ b/src/app/cursor.coffee @@ -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) diff --git a/src/app/edit-session.coffee b/src/app/edit-session.coffee index 64f6a2a6c..b420f7875 100644 --- a/src/app/edit-session.coffee +++ b/src/app/edit-session.coffee @@ -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 diff --git a/src/app/editor.coffee b/src/app/editor.coffee index a9583b713..a3bed0f00 100644 --- a/src/app/editor.coffee +++ b/src/app/editor.coffee @@ -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)