mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Merge branch 'master' into ns-telepathic-atom-global
Conflicts: src/atom.coffee
This commit is contained in:
@@ -106,7 +106,7 @@ class Atom extends Model
|
||||
|
||||
# Public: Get the version of the Atom application.
|
||||
@getVersion: ->
|
||||
app.getVersion()
|
||||
@version ?= app.getVersion()
|
||||
|
||||
# Public: Determine whether the current version is an official release.
|
||||
@isReleasedVersion: ->
|
||||
|
||||
@@ -11,6 +11,7 @@ _ = require 'underscore-plus'
|
||||
module.exports =
|
||||
class AtomWindow
|
||||
@iconPath: path.resolve(__dirname, '..', '..', 'resources', 'atom.png')
|
||||
@includeShellLoadTime: true
|
||||
|
||||
browserWindow: null
|
||||
loaded: null
|
||||
@@ -30,6 +31,12 @@ class AtomWindow
|
||||
|
||||
loadSettings = _.extend({}, settings)
|
||||
loadSettings.windowState ?= ''
|
||||
|
||||
# Only send to the first non-spec window created
|
||||
if @constructor.includeShellLoadTime and not @isSpec
|
||||
@constructor.includeShellLoadTime = false
|
||||
loadSettings.shellLoadTime ?= Date.now() - global.shellStartTime
|
||||
|
||||
loadSettings.initialPath = pathToOpen
|
||||
if fs.statSyncNoException(pathToOpen).isFile?()
|
||||
loadSettings.initialPath = path.dirname(pathToOpen)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
startTime = Date.now()
|
||||
global.shellStartTime = Date.now()
|
||||
|
||||
autoUpdater = require 'auto-updater'
|
||||
crashReporter = require 'crash-reporter'
|
||||
@@ -62,7 +62,7 @@ delegate.browserMainParts.preMainMessageLoopRun = ->
|
||||
AtomApplication = require './atom-application'
|
||||
|
||||
AtomApplication.open(args)
|
||||
console.log("App load time: #{Date.now() - startTime}ms") unless args.test
|
||||
console.log("App load time: #{Date.now() - global.shellStartTime}ms") unless args.test
|
||||
|
||||
global.devResourcePath = path.join(app.getHomeDir(), 'github', 'atom')
|
||||
|
||||
|
||||
@@ -63,9 +63,6 @@ class Pane extends View
|
||||
unless activeItemUri? and @showItemForUri(activeItemUri)
|
||||
@showItem(@items[0]) if @items.length > 0
|
||||
|
||||
@command 'core:close', @destroyActiveItem
|
||||
@command 'core:save', @saveActiveItem
|
||||
@command 'core:save-as', @saveActiveItemAs
|
||||
@command 'pane:save-items', @saveItems
|
||||
@command 'pane:show-next-item', @showNextItem
|
||||
@command 'pane:show-previous-item', @showPreviousItem
|
||||
|
||||
@@ -57,6 +57,8 @@ class Token
|
||||
|
||||
outputTokens
|
||||
else
|
||||
return [this] if @isAtomic
|
||||
|
||||
if breakOutLeadingWhitespace
|
||||
return [this] unless /^[ ]|\t/.test(@value)
|
||||
else
|
||||
|
||||
@@ -73,6 +73,25 @@ class WindowEventHandler
|
||||
e.preventDefault()
|
||||
atom.contextMenu.showForEvent(e)
|
||||
|
||||
@handleNativeKeybindings()
|
||||
|
||||
# Private: Wire commands that should be handled by the native menu
|
||||
# for elements with the `.native-key-bindings` class.
|
||||
handleNativeKeybindings: ->
|
||||
menu = null
|
||||
bindCommandToAction = (command, action) =>
|
||||
@subscribe $(document), command, (event) ->
|
||||
if event.target.webkitMatchesSelector('.native-key-bindings')
|
||||
menu ?= require('remote').require('menu')
|
||||
menu.sendActionToFirstResponder(action)
|
||||
true
|
||||
|
||||
bindCommandToAction('core:copy', 'copy:')
|
||||
bindCommandToAction('core:paste', 'paste:')
|
||||
bindCommandToAction('core:undo', 'undo:')
|
||||
bindCommandToAction('core:redo', 'redo:')
|
||||
bindCommandToAction('core:select-all', 'selectAll:')
|
||||
|
||||
openLink: (event) =>
|
||||
location = $(event.target).attr('href')
|
||||
if location and location[0] isnt '#' and /^https?:\/\//.test(location)
|
||||
@@ -105,7 +124,10 @@ class WindowEventHandler
|
||||
nextTabIndex = tabIndex
|
||||
nextElement = element
|
||||
|
||||
(nextElement ? lowestElement).focus()
|
||||
if nextElement?
|
||||
nextElement.focus()
|
||||
else if lowestElement?
|
||||
lowestElement.focus()
|
||||
|
||||
focusPrevious: =>
|
||||
focusedTabIndex = parseInt($(':focus').attr('tabindex')) or Infinity
|
||||
@@ -123,4 +145,7 @@ class WindowEventHandler
|
||||
previousTabIndex = tabIndex
|
||||
previousElement = element
|
||||
|
||||
(previousElement ? highestElement).focus()
|
||||
if previousElement?
|
||||
previousElement.focus()
|
||||
else if highestElement?
|
||||
highestElement.focus()
|
||||
|
||||
@@ -126,6 +126,10 @@ class WorkspaceView extends View
|
||||
|
||||
@command 'pane:reopen-closed-item', => @reopenItemSync()
|
||||
|
||||
@command 'core:close', => @destroyActivePaneItem()
|
||||
@command 'core:save', => @saveActivePaneItem()
|
||||
@command 'core:save-as', => @saveActivePaneItemAs()
|
||||
|
||||
# Private:
|
||||
serialize: ->
|
||||
state = @state.clone()
|
||||
@@ -280,6 +284,18 @@ class WorkspaceView extends View
|
||||
getActiveView: ->
|
||||
@panes.getActiveView()
|
||||
|
||||
# Public: destroy/close the active item.
|
||||
destroyActivePaneItem: ->
|
||||
@getActivePane()?.destroyActiveItem()
|
||||
|
||||
# Public: save the active item.
|
||||
saveActivePaneItem: ->
|
||||
@getActivePane()?.saveActiveItem()
|
||||
|
||||
# Public: save the active item as.
|
||||
saveActivePaneItemAs: ->
|
||||
@getActivePane()?.saveActiveItemAs()
|
||||
|
||||
# Public: Focuses the previous pane by id.
|
||||
focusPreviousPane: -> @panes.focusPreviousPane()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user