mirror of
https://github.com/atom/atom.git
synced 2026-02-14 08:35:11 -05:00
Merge branch 'dev' into css-theme-refactor
This commit is contained in:
@@ -150,7 +150,7 @@ class Cursor
|
||||
previousLinesRange = [[previousNonBlankRow, 0], currentBufferPosition]
|
||||
|
||||
beginningOfWordPosition = currentBufferPosition
|
||||
@editSession.backwardsScanInRange @wordRegex, previousLinesRange, (match, matchRange, { stop }) =>
|
||||
@editSession.backwardsScanInRange (options.wordRegex || @wordRegex), previousLinesRange, (match, matchRange, { stop }) =>
|
||||
if matchRange.end.isGreaterThanOrEqual(currentBufferPosition) or allowPrevious
|
||||
beginningOfWordPosition = matchRange.start
|
||||
stop()
|
||||
@@ -162,15 +162,17 @@ class Cursor
|
||||
range = [currentBufferPosition, @editSession.getEofBufferPosition()]
|
||||
|
||||
endOfWordPosition = null
|
||||
@editSession.scanInRange @wordRegex, range, (match, matchRange, { stop }) =>
|
||||
@editSession.scanInRange (options.wordRegex || @wordRegex), range, (match, matchRange, { stop }) =>
|
||||
endOfWordPosition = matchRange.end
|
||||
if not allowNext and matchRange.start.isGreaterThan(currentBufferPosition)
|
||||
endOfWordPosition = currentBufferPosition
|
||||
stop()
|
||||
endOfWordPosition or currentBufferPosition
|
||||
|
||||
getCurrentWordBufferRange: ->
|
||||
new Range(@getBeginningOfCurrentWordBufferPosition(allowPrevious: false), @getEndOfCurrentWordBufferPosition(allowNext: false))
|
||||
getCurrentWordBufferRange: (options={}) ->
|
||||
startOptions = _.extend(_.clone(options), allowPrevious: false)
|
||||
endOptions = _.extend(_.clone(options), allowNext: false)
|
||||
new Range(@getBeginningOfCurrentWordBufferPosition(startOptions), @getEndOfCurrentWordBufferPosition(endOptions))
|
||||
|
||||
getCurrentLineBufferRange: (options) ->
|
||||
@editSession.bufferRangeForBufferRow(@getBufferRow(), options)
|
||||
|
||||
@@ -498,6 +498,9 @@ class EditSession
|
||||
getCurrentParagraphBufferRange: ->
|
||||
@getCursor().getCurrentParagraphBufferRange()
|
||||
|
||||
getWordUnderCursor: (options) ->
|
||||
@getTextInBufferRange(@getCursor().getCurrentWordBufferRange(options))
|
||||
|
||||
moveCursorUp: (lineCount) ->
|
||||
@moveCursors (cursor) -> cursor.moveUp(lineCount)
|
||||
|
||||
|
||||
@@ -209,6 +209,7 @@ class Editor extends View
|
||||
setCursorBufferPosition: (position, options) -> @activeEditSession.setCursorBufferPosition(position, options)
|
||||
getCursorBufferPosition: -> @activeEditSession.getCursorBufferPosition()
|
||||
getCurrentParagraphBufferRange: -> @activeEditSession.getCurrentParagraphBufferRange()
|
||||
getWordUnderCursor: (options) -> @activeEditSession.getWordUnderCursor(options)
|
||||
|
||||
getSelection: (index) -> @activeEditSession.getSelection(index)
|
||||
getSelections: -> @activeEditSession.getSelections()
|
||||
|
||||
@@ -55,6 +55,7 @@ class LanguageMode
|
||||
@grammar = @buffer.project.grammarForFilePath(path, pathContents)
|
||||
else
|
||||
@grammar = syntax.grammarForFilePath(path, pathContents)
|
||||
throw new Error("No grammar found for path: #{path}") unless @grammar
|
||||
previousGrammar isnt @grammar
|
||||
|
||||
isQuote: (string) ->
|
||||
|
||||
@@ -83,7 +83,7 @@ class Project
|
||||
@ignoreRepositoryPath(path)
|
||||
|
||||
ignoreRepositoryPath: (path) ->
|
||||
config.get("core.hideGitIgnoredFiles") and @repo.isPathIgnored(fs.join(@getPath(), path))
|
||||
config.get("core.hideGitIgnoredFiles") and @repo?.isPathIgnored(fs.join(@getPath(), path))
|
||||
|
||||
resolve: (filePath) ->
|
||||
filePath = fs.join(@getPath(), filePath) unless filePath[0] == '/'
|
||||
|
||||
Reference in New Issue
Block a user