mirror of
https://github.com/atom/atom.git
synced 2026-02-09 14:15:24 -05:00
Merge remote-tracking branch 'remotes/origin/master' into dh-async-repo
This commit is contained in:
@@ -378,14 +378,16 @@ class AtomApplication
|
||||
|
||||
unless pidToKillWhenClosed or newWindow
|
||||
existingWindow = @windowForPaths(pathsToOpen, devMode)
|
||||
|
||||
# Default to using the specified window or the last focused window
|
||||
currentWindow = window ? @lastFocusedWindow
|
||||
stats = (fs.statSyncNoException(pathToOpen) for pathToOpen in pathsToOpen)
|
||||
existingWindow ?= currentWindow if (
|
||||
stats.every((stat) -> stat.isFile?()) or
|
||||
stats.some((stat) -> stat.isDirectory?()) and not currentWindow?.hasProjectPath()
|
||||
)
|
||||
unless existingWindow?
|
||||
if currentWindow = window ? @lastFocusedWindow
|
||||
existingWindow = currentWindow if (
|
||||
currentWindow.devMode is devMode and
|
||||
(
|
||||
stats.every((stat) -> stat.isFile?()) or
|
||||
stats.some((stat) -> stat.isDirectory?() and not currentWindow.hasProjectPath())
|
||||
)
|
||||
)
|
||||
|
||||
if existingWindow?
|
||||
openedWindow = existingWindow
|
||||
|
||||
@@ -17,14 +17,8 @@ class AutoUpdateManager
|
||||
|
||||
constructor: (@version, @testMode, @disabled) ->
|
||||
@state = IdleState
|
||||
if process.platform is 'win32'
|
||||
# Squirrel for Windows can't handle query params
|
||||
# https://github.com/Squirrel/Squirrel.Windows/issues/132
|
||||
@feedUrl = 'https://atom.io/api/updates'
|
||||
else
|
||||
@iconPath = path.resolve(__dirname, '..', '..', 'resources', 'atom.png')
|
||||
@feedUrl = "https://atom.io/api/updates?version=#{@version}"
|
||||
|
||||
@iconPath = path.resolve(__dirname, '..', '..', 'resources', 'atom.png')
|
||||
@feedUrl = "https://atom.io/api/updates?version=#{@version}"
|
||||
process.nextTick => @setupAutoUpdater()
|
||||
|
||||
setupAutoUpdater: ->
|
||||
|
||||
@@ -422,7 +422,6 @@ class Config
|
||||
# * `event` {Object}
|
||||
# * `newValue` the new value of the key
|
||||
# * `oldValue` the prior value of the key.
|
||||
# * `keyPath` the keyPath of the changed key
|
||||
#
|
||||
# Returns a {Disposable} with the following keys on which you can call
|
||||
# `.dispose()` to unsubscribe.
|
||||
|
||||
@@ -75,7 +75,7 @@ class Cursor extends Model
|
||||
@changePosition options, =>
|
||||
@marker.setHeadScreenPosition(screenPosition, options)
|
||||
|
||||
# Public: Returns the screen position of the cursor as an Array.
|
||||
# Public: Returns the screen position of the cursor as a {Point}.
|
||||
getScreenPosition: ->
|
||||
@marker.getHeadScreenPosition()
|
||||
|
||||
|
||||
@@ -44,16 +44,16 @@ class PaneElement extends HTMLElement
|
||||
event.stopPropagation()
|
||||
@getModel().activate()
|
||||
pathsToOpen = Array::map.call event.dataTransfer.files, (file) -> file.path
|
||||
@open({pathsToOpen}) if pathsToOpen.length > 0
|
||||
@applicationDelegate.open({pathsToOpen}) if pathsToOpen.length > 0
|
||||
|
||||
@addEventListener 'focus', handleFocus, true
|
||||
@addEventListener 'blur', handleBlur, true
|
||||
@addEventListener 'dragover', handleDragOver
|
||||
@addEventListener 'drop', handleDrop
|
||||
|
||||
initialize: (@model, {@views, @open}) ->
|
||||
initialize: (@model, {@views, @applicationDelegate}) ->
|
||||
throw new Error("Must pass a views parameter when initializing PaneElements") unless @views?
|
||||
throw new Error("Must pass a open parameter when initializing PaneElements") unless @open?
|
||||
throw new Error("Must pass an applicationDelegate parameter when initializing PaneElements") unless @applicationDelegate?
|
||||
|
||||
@subscriptions.add @model.onDidActivate(@activated.bind(this))
|
||||
@subscriptions.add @model.observeActive(@activeStatusChanged.bind(this))
|
||||
|
||||
@@ -525,7 +525,8 @@ class Pane extends Model
|
||||
|
||||
# Public: Save all items.
|
||||
saveItems: ->
|
||||
@saveItem(item) for item in @getItems()
|
||||
for item in @getItems()
|
||||
@saveItem(item) if item.isModified?()
|
||||
return
|
||||
|
||||
# Public: Return the first item that matches the given URI or undefined if
|
||||
@@ -679,6 +680,30 @@ class Pane extends Model
|
||||
else
|
||||
@splitRight()
|
||||
|
||||
# If the parent is a vertical axis, returns its first child if it is a pane;
|
||||
# otherwise returns this pane.
|
||||
findTopmostSibling: ->
|
||||
if @parent.orientation is 'vertical'
|
||||
[topmostSibling] = @parent.children
|
||||
if topmostSibling instanceof PaneAxis
|
||||
this
|
||||
else
|
||||
topmostSibling
|
||||
else
|
||||
this
|
||||
|
||||
# If the parent is a vertical axis, returns its last child if it is a pane;
|
||||
# otherwise returns a new pane created by splitting this pane bottomward.
|
||||
findOrCreateBottommostSibling: ->
|
||||
if @parent.orientation is 'vertical'
|
||||
bottommostSibling = last(@parent.children)
|
||||
if bottommostSibling instanceof PaneAxis
|
||||
@splitRight()
|
||||
else
|
||||
bottommostSibling
|
||||
else
|
||||
@splitDown()
|
||||
|
||||
close: ->
|
||||
@destroy() if @confirmClose()
|
||||
|
||||
|
||||
@@ -382,9 +382,11 @@ class Workspace extends Model
|
||||
# initially. Defaults to `0`.
|
||||
# * `initialColumn` A {Number} indicating which column to move the cursor to
|
||||
# initially. Defaults to `0`.
|
||||
# * `split` Either 'left' or 'right'. If 'left', the item will be opened in
|
||||
# leftmost pane of the current active pane's row. If 'right', the
|
||||
# item will be opened in the rightmost pane of the current active pane's row.
|
||||
# * `split` Either 'left', 'right', 'top' or 'bottom'.
|
||||
# If 'left', the item will be opened in leftmost pane of the current active pane's row.
|
||||
# If 'right', the item will be opened in the rightmost pane of the current active pane's row.
|
||||
# If 'up', the item will be opened in topmost pane of the current active pane's row.
|
||||
# If 'down', the item will be opened in the bottommost pane of the current active pane's row.
|
||||
# * `activatePane` A {Boolean} indicating whether to call {Pane::activate} on
|
||||
# containing pane. Defaults to `true`.
|
||||
# * `activateItem` A {Boolean} indicating whether to call {Pane::activateItem}
|
||||
@@ -406,6 +408,10 @@ class Workspace extends Model
|
||||
@getActivePane().findLeftmostSibling()
|
||||
when 'right'
|
||||
@getActivePane().findOrCreateRightmostSibling()
|
||||
when 'up'
|
||||
@getActivePane().findTopmostSibling()
|
||||
when 'down'
|
||||
@getActivePane().findOrCreateBottommostSibling()
|
||||
else
|
||||
@getActivePane()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user