Skip to content

Commit

Permalink
Merge branch 'stable' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
maxbrunsfeld committed Feb 2, 2016
2 parents 331637c + 164201e commit 6d56185
Showing 3 changed files with 27 additions and 2 deletions.
21 changes: 21 additions & 0 deletions spec/workspace-spec.coffee
Original file line number Diff line number Diff line change
@@ -471,6 +471,27 @@ describe "Workspace", ->
workspace.open("bar://baz").then (item) ->
expect(item).toEqual {bar: "bar://baz"}

it "adds the file to the application's recent documents list", ->
spyOn(atom.applicationDelegate, 'addRecentDocument')

waitsForPromise ->
workspace.open()

runs ->
expect(atom.applicationDelegate.addRecentDocument).not.toHaveBeenCalled()

waitsForPromise ->
workspace.open('something://a/url')

runs ->
expect(atom.applicationDelegate.addRecentDocument).not.toHaveBeenCalled()

waitsForPromise ->
workspace.open(__filename)

runs ->
expect(atom.applicationDelegate.addRecentDocument).toHaveBeenCalledWith(__filename)

it "notifies ::onDidAddTextEditor observers", ->
absolutePath = require.resolve('./fixtures/dir/a')
newEditorHandler = jasmine.createSpy('newEditorHandler')
2 changes: 0 additions & 2 deletions src/atom-environment.coffee
Original file line number Diff line number Diff line change
@@ -885,8 +885,6 @@ class AtomEnvironment extends Model
else
@project.addPath(pathToOpen)

@applicationDelegate.addRecentDocument(pathToOpen)

unless fs.isDirectorySync(pathToOpen)
@workspace?.open(pathToOpen, {initialLine, initialColumn})

6 changes: 6 additions & 0 deletions src/workspace.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
_ = require 'underscore-plus'
url = require 'url'
path = require 'path'
{join} = path
{Emitter, Disposable, CompositeDisposable} = require 'event-kit'
@@ -409,6 +410,11 @@ class Workspace extends Model
split = options.split
uri = @project.resolvePath(uri)

# Avoid adding URLs as recent documents to work-around this Spotlight crash:
# https://github.com/atom/atom/issues/10071
if uri? and not url.parse(uri).protocol?
@applicationDelegate.addRecentDocument(uri)

pane = @paneContainer.paneForURI(uri) if searchAllPanes
pane ?= switch split
when 'left'

0 comments on commit 6d56185

Please sign in to comment.