Merge branch 'master' into mb-custom-extension-grammar-map

Conflicts:
	package.json
This commit is contained in:
Max Brunsfeld
2015-08-12 17:31:15 -07:00
24 changed files with 231 additions and 201 deletions

View File

@@ -15,6 +15,18 @@ stats =
misses: 0
defaultOptions =
# Currently, the cache key is a function of:
# * The version of Babel used to transpile the .js file.
# * The contents of this defaultOptions object.
# * The contents of the .js file.
# That means that we cannot allow information from an unknown source
# to affect the cache key for the output of transpilation, which means
# we cannot allow users to override these default options via a .babelrc
# file, because the contents of that .babelrc file will not make it into
# the cache key. It would be great to support .babelrc files once we
# have a way to do so that is safe with respect to caching.
breakConfig: true
# The Chrome dev tools will show the original version of the file
# when the source map is inlined.
sourceMap: 'inline'

View File

@@ -67,10 +67,20 @@ class Marker
@bufferMarker.destroy()
@disposables.dispose()
# Essential: Creates and returns a new {Marker} with the same properties as this
# marker.
# Essential: Creates and returns a new {Marker} with the same properties as
# this marker.
#
# * `properties` {Object}
# {Selection} markers (markers with a custom property `type: "selection"`)
# should be copied with a different `type` value, for example with
# `marker.copy({type: null})`. Otherwise, the new marker's selection will
# be merged with this marker's selection, and a `null` value will be
# returned.
#
# * `properties` (optional) {Object} properties to associate with the new
# marker. The new marker's properties are computed by extending this marker's
# properties with `properties`.
#
# Returns a {Marker}.
copy: (properties) ->
@displayBuffer.getMarker(@bufferMarker.copy(properties).id)

View File

@@ -310,12 +310,12 @@ class PackageManager
@activatePackage(packageName) for packageName in packagesToEnable
null
unobserveDisabledKeymaps: ->
@disabledKeymapsSubscription?.dispose()
@disabledKeymapsSubscription = null
unobservePackagesWithKeymapsDisabled: ->
@packagesWithKeymapsDisabledSubscription?.dispose()
@packagesWithKeymapsDisabledSubscription = null
observeDisabledKeymaps: ->
@disabledKeymapsSubscription ?= atom.config.onDidChange 'core.disabledKeymaps', ({newValue, oldValue}) =>
observePackagesWithKeymapsDisabled: ->
@packagesWithKeymapsDisabledSubscription ?= atom.config.onDidChange 'core.packagesWithKeymapsDisabled', ({newValue, oldValue}) =>
keymapsToEnable = _.difference(oldValue, newValue)
keymapsToDisable = _.difference(newValue, oldValue)
@@ -409,7 +409,7 @@ class PackageManager
promises.push(promise) unless pack.hasActivationCommands()
return
@observeDisabledPackages()
@observeDisabledKeymaps()
@observePackagesWithKeymapsDisabled()
promises
# Activate a single package by name
@@ -438,7 +438,7 @@ class PackageManager
@deactivatePackage(pack.name) for pack in @getLoadedPackages()
return
@unobserveDisabledPackages()
@unobserveDisabledKeymaps()
@unobservePackagesWithKeymapsDisabled()
# Deactivate the package with the given name
deactivatePackage: (name) ->

View File

@@ -201,7 +201,7 @@ class Package
activateResources: ->
@activationDisposables = new CompositeDisposable
keymapIsDisabled = _.include(atom.config.get("core.disabledKeymaps") ? [], @name)
keymapIsDisabled = _.include(atom.config.get("core.packagesWithKeymapsDisabled") ? [], @name)
if keymapIsDisabled
@deactivateKeymaps()
else

View File

@@ -135,21 +135,23 @@ class PaneElement extends HTMLElement
hasFocus: ->
this is document.activeElement or @contains(document.activeElement)
atom.commands.add 'atom-workspace',
'pane:show-next-item': -> @getModel().getActivePane().activateNextItem()
'pane:show-previous-item': -> @getModel().getActivePane().activatePreviousItem()
'pane:show-item-1': -> @getModel().getActivePane().activateItemAtIndex(0)
'pane:show-item-2': -> @getModel().getActivePane().activateItemAtIndex(1)
'pane:show-item-3': -> @getModel().getActivePane().activateItemAtIndex(2)
'pane:show-item-4': -> @getModel().getActivePane().activateItemAtIndex(3)
'pane:show-item-5': -> @getModel().getActivePane().activateItemAtIndex(4)
'pane:show-item-6': -> @getModel().getActivePane().activateItemAtIndex(5)
'pane:show-item-7': -> @getModel().getActivePane().activateItemAtIndex(6)
'pane:show-item-8': -> @getModel().getActivePane().activateItemAtIndex(7)
'pane:show-item-9': -> @getModel().getActivePane().activateItemAtIndex(8)
'pane:move-item-right': -> @getModel().getActivePane().moveItemRight()
'pane:move-item-left': -> @getModel().getActivePane().moveItemLeft()
atom.commands.add 'atom-pane',
'pane:save-items': -> @getModel().saveItems()
'pane:show-next-item': -> @getModel().activateNextItem()
'pane:show-previous-item': -> @getModel().activatePreviousItem()
'pane:show-item-1': -> @getModel().activateItemAtIndex(0)
'pane:show-item-2': -> @getModel().activateItemAtIndex(1)
'pane:show-item-3': -> @getModel().activateItemAtIndex(2)
'pane:show-item-4': -> @getModel().activateItemAtIndex(3)
'pane:show-item-5': -> @getModel().activateItemAtIndex(4)
'pane:show-item-6': -> @getModel().activateItemAtIndex(5)
'pane:show-item-7': -> @getModel().activateItemAtIndex(6)
'pane:show-item-8': -> @getModel().activateItemAtIndex(7)
'pane:show-item-9': -> @getModel().activateItemAtIndex(8)
'pane:move-item-right': -> @getModel().moveItemRight()
'pane:move-item-left': -> @getModel().moveItemLeft()
'pane:split-left': -> @getModel().splitLeft(copyActiveItem: true)
'pane:split-right': -> @getModel().splitRight(copyActiveItem: true)
'pane:split-up': -> @getModel().splitUp(copyActiveItem: true)

View File

@@ -404,7 +404,7 @@ class TextEditorComponent
@editor.getLastSelection().selectLine()
@handleDragUntilMouseUp event, (screenPosition) =>
@editor.selectToScreenPosition(screenPosition)
@editor.selectToScreenPosition(screenPosition, true)
onLineNumberGutterMouseDown: (event) =>
return unless event.button is 0 # only handle the left mouse button
@@ -428,9 +428,10 @@ class TextEditorComponent
dragRow = screenPosition.row
dragBufferRow = @editor.bufferRowForScreenRow(dragRow)
if dragBufferRow < clickedBufferRow # dragging up
@editor.setSelectedBufferRange([[dragBufferRow, 0], [clickedBufferRow + 1, 0]], preserveFolds: true)
@editor.setSelectedBufferRange([[dragBufferRow, 0], [clickedBufferRow + 1, 0]], reversed: true, preserveFolds: true, autoscroll: false)
else
@editor.setSelectedBufferRange([[clickedBufferRow, 0], [dragBufferRow + 1, 0]], preserveFolds: true)
@editor.setSelectedBufferRange([[clickedBufferRow, 0], [dragBufferRow + 1, 0]], reversed: false, preserveFolds: true, autoscroll: false)
@editor.getLastCursor().autoscroll()
onGutterMetaClick: (event) =>
clickedRow = @screenPositionForMouseEvent(event).row
@@ -448,9 +449,6 @@ class TextEditorComponent
else
rowSelection.setBufferRange([[clickedBufferRow, 0], [dragBufferRow + 1, 0]], preserveFolds: true)
# After updating the selected screen range, merge overlapping selections
@editor.mergeIntersectingSelections(preserveFolds: true)
# The merge process will possibly destroy the current selection because
# it will be merged into another one. Therefore, we need to obtain a
# reference to the new selection that contains the originally selected row
@@ -552,6 +550,7 @@ class TextEditorComponent
onMouseUp = (event) =>
stopDragging()
@editor.finalizeSelections()
@editor.mergeIntersectingSelections()
pasteSelectionClipboard(event)
stopDragging = ->

View File

@@ -1948,10 +1948,11 @@ class TextEditor extends Model
# This method may merge selections that end up intesecting.
#
# * `position` An instance of {Point}, with a given `row` and `column`.
selectToScreenPosition: (position) ->
selectToScreenPosition: (position, suppressMerge) ->
lastSelection = @getLastSelection()
lastSelection.selectToScreenPosition(position)
@mergeIntersectingSelections(reversed: lastSelection.isReversed())
unless suppressMerge
@mergeIntersectingSelections(reversed: lastSelection.isReversed())
# Essential: Move the cursor of each selection one character upward while
# preserving the selection's tail position.

View File

@@ -490,7 +490,7 @@ class TokenizedBuffer extends Model
scopes.pop()
else
endColumn = startColumn + tag
if endColumn > position.column
if endColumn >= position.column
break
else
startColumn = endColumn

View File

@@ -387,15 +387,17 @@ class TokenizedLine
rightSpecialTokens[rightTags.length] = specialToken
rightTags.push(tag)
# tag represents the start or end of a scop
# tag represents the start of a scope
else if (tag % 2) is -1
if screenColumn < column
leftTags.push(tag)
rightOpenScopes.push(tag)
else
rightTags.push(tag)
# tag represents the end of a scope
else
if screenColumn < column
if screenColumn <= column
leftTags.push(tag)
rightOpenScopes.pop()
else

View File

@@ -70,24 +70,15 @@ class ViewRegistry
# workspace what view constructor it should use to represent them:
#
# ```coffee
# atom.views.addViewProvider
# modelConstructor: TextEditor
# viewConstructor: TextEditorElement
# atom.views.addViewProvider TextEditor, (textEditor) ->
# textEditorElement = new TextEditorElement
# textEditorElement.initialize(textEditor)
# textEditorElement
# ```
#
# * `providerSpec` {Object} containing the following keys:
# * `modelConstructor` Constructor {Function} for your model.
# * `viewConstructor` (Optional) Constructor {Function} for your view. It
# should be a subclass of `HTMLElement` (that is, your view should be a
# DOM node) and have a `::setModel()` method which will be called
# immediately after construction. If you don't supply this property, you
# must supply the `createView` property with a function that never returns
# `undefined`.
# * `createView` (Optional) Factory {Function} that must return a subclass
# of `HTMLElement` or `undefined`. If this property is not present or the
# function returns `undefined`, the view provider will fall back to the
# `viewConstructor` property. If you don't provide this property, you must
# provider a `viewConstructor` property.
# * `modelConstructor` Constructor {Function} for your model.
# * `createView` Factory {Function} that is passed an instance of your model
# and must return a subclass of `HTMLElement` or `undefined`.
#
# Returns a {Disposable} on which `.dispose()` can be called to remove the
# added provider.

View File

@@ -468,11 +468,11 @@ class Workspace extends Model
pane.activate() if activatePane
initialLine = initialColumn = 0
if Number.isFinite(options.initialLine)
unless Number.isNaN(options.initialLine)
initialLine = options.initialLine
if Number.isFinite(options.initialColumn)
unless Number.isNaN(options.initialColumn)
initialColumn = options.initialColumn
if initialLine > 0 or initialColumn > 0
if initialLine >= 0 or initialColumn >= 0
item.setCursorBufferPosition?([initialLine, initialColumn])
index = pane.getActiveItemIndex()