mirror of
https://github.com/atom/atom.git
synced 2026-02-13 08:04:56 -05:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -669,6 +669,7 @@ class Atom extends Model
|
||||
@windowEventHandler?.unsubscribe()
|
||||
|
||||
openInitialEmptyEditorIfNecessary: ->
|
||||
return unless @config.get('core.openEmptyEditorOnStart')
|
||||
if @getLoadSettings().initialPaths?.length is 0 and @workspace.getPaneItems().length is 0
|
||||
@workspace.open(null)
|
||||
|
||||
|
||||
@@ -89,6 +89,10 @@ module.exports =
|
||||
'windows1258',
|
||||
'windows866'
|
||||
]
|
||||
openEmptyEditorOnStart:
|
||||
description: 'Automatically opens an empty editor when atom starts.'
|
||||
type: 'boolean'
|
||||
default: true
|
||||
|
||||
editor:
|
||||
type: 'object'
|
||||
|
||||
@@ -865,7 +865,7 @@ class Config
|
||||
|
||||
if value?
|
||||
value = @deepClone(value)
|
||||
_.defaults(value, defaultValue) if isPlainObject(value) and isPlainObject(defaultValue)
|
||||
@deepDefaults(value, defaultValue) if isPlainObject(value) and isPlainObject(defaultValue)
|
||||
else
|
||||
value = @deepClone(defaultValue)
|
||||
|
||||
@@ -928,6 +928,19 @@ class Config
|
||||
else
|
||||
object
|
||||
|
||||
deepDefaults: (target) ->
|
||||
result = target
|
||||
i = 0
|
||||
while ++i < arguments.length
|
||||
object = arguments[i]
|
||||
if isPlainObject(result) and isPlainObject(object)
|
||||
for key in Object.keys(object)
|
||||
result[key] = @deepDefaults(result[key], object[key])
|
||||
else
|
||||
if not result?
|
||||
result = @deepClone(object)
|
||||
result
|
||||
|
||||
# `schema` will look something like this
|
||||
#
|
||||
# ```coffee
|
||||
|
||||
@@ -86,9 +86,14 @@ class ContextMenuManager
|
||||
# * `label` (Optional) A {String} containing the menu item's label.
|
||||
# * `command` (Optional) A {String} containing the command to invoke on the
|
||||
# target of the right click that invoked the context menu.
|
||||
# * `enabled` (Optional) A {Boolean} indicating whether the menu item
|
||||
# should be clickable. Disabled menu items typically appear grayed out.
|
||||
# Defaults to `true`.
|
||||
# * `submenu` (Optional) An {Array} of additional items.
|
||||
# * `type` (Optional) If you want to create a separator, provide an item
|
||||
# with `type: 'separator'` and no other keys.
|
||||
# * `visible` (Optional) A {Boolean} indicating whether the menu item
|
||||
# should appear in the menu. Defaults to `true`.
|
||||
# * `created` (Optional) A {Function} that is called on the item each time a
|
||||
# context menu is created via a right click. You can assign properties to
|
||||
# `this` to dynamically compute the command, label, etc. This method is
|
||||
|
||||
@@ -1119,12 +1119,12 @@ class TextEditor extends Model
|
||||
|
||||
# Essential: Undo the last change.
|
||||
undo: ->
|
||||
@buffer.undo()
|
||||
@avoidMergingSelections => @buffer.undo()
|
||||
@getLastSelection().autoscroll()
|
||||
|
||||
# Essential: Redo the last change.
|
||||
redo: ->
|
||||
@buffer.redo(this)
|
||||
@avoidMergingSelections => @buffer.redo()
|
||||
@getLastSelection().autoscroll()
|
||||
|
||||
# Extended: Batch multiple operations as a single undo/redo step.
|
||||
@@ -2217,6 +2217,9 @@ class TextEditor extends Model
|
||||
|
||||
previousSelection.intersectsScreenRowRange(screenRange.start.row, screenRange.end.row)
|
||||
|
||||
avoidMergingSelections: (args...) ->
|
||||
@mergeSelections args..., -> false
|
||||
|
||||
mergeSelections: (args...) ->
|
||||
mergePredicate = args.pop()
|
||||
fn = args.pop() if _.isFunction(_.last(args))
|
||||
|
||||
Reference in New Issue
Block a user