mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-21 07:58:04 +03:00
Remove 'split' option from Workspace::openSync
This commit is contained in:
parent
726b546004
commit
933787f1a4
@ -49,23 +49,6 @@ describe "Workspace", ->
|
||||
workspace.openSync('b', activatePane: false)
|
||||
expect(activePane.activate).not.toHaveBeenCalled()
|
||||
|
||||
describe "when the 'split' option is specified", ->
|
||||
it "activates the editor on the active pane if it has a sibling and otherwise creates a new pane", ->
|
||||
pane1 = workspace.activePane
|
||||
|
||||
editor = workspace.openSync('a', split: 'right')
|
||||
pane2 = workspace.activePane
|
||||
expect(pane2).not.toBe pane1
|
||||
|
||||
expect(workspace.paneContainer.root.children).toEqual [pane1, pane2]
|
||||
|
||||
editor = workspace.openSync('file1', split: 'right')
|
||||
expect(workspace.activePane).toBe pane2
|
||||
|
||||
expect(workspace.paneContainer.root.children).toEqual [pane1, pane2]
|
||||
expect(pane1.items.length).toBe 0
|
||||
expect(pane2.items.length).toBe 2
|
||||
|
||||
describe "::openSingletonSync(uri, options)", ->
|
||||
describe "when an editor for the given uri is already open on the active pane", ->
|
||||
it "activates the existing editor", ->
|
||||
|
@ -78,37 +78,20 @@ class Workspace extends Model
|
||||
|
||||
# Private: Only used in specs
|
||||
openSync: (uri, options={}) ->
|
||||
{initialLine, pane, split} = options
|
||||
{initialLine} = options
|
||||
# TODO: Remove deprecated changeFocus option
|
||||
activatePane = options.activatePane ? options.changeFocus ? true
|
||||
pane ?= @activePane
|
||||
uri = atom.project.relativize(uri)
|
||||
|
||||
if pane
|
||||
if uri
|
||||
paneItem = pane.itemForUri(uri) ? atom.project.openSync(uri, {initialLine})
|
||||
else
|
||||
paneItem = atom.project.openSync()
|
||||
|
||||
if split == 'right'
|
||||
panes = @getPanes()
|
||||
if panes.length == 1
|
||||
pane = panes[0].splitRight()
|
||||
else
|
||||
pane = last(panes)
|
||||
else if split == 'left'
|
||||
pane = @getPanes()[0]
|
||||
|
||||
pane.activateItem(paneItem)
|
||||
if uri?
|
||||
editor = @activePane.itemForUri(uri) ? atom.project.openSync(uri, {initialLine})
|
||||
else
|
||||
paneItem = atom.project.openSync(uri, {initialLine})
|
||||
pane = new Pane(items: [paneItem])
|
||||
@paneContainer.root = pane
|
||||
editor = atom.project.openSync()
|
||||
|
||||
@itemOpened(paneItem)
|
||||
|
||||
pane.activate() if activatePane
|
||||
paneItem
|
||||
@activePane.activateItem(editor)
|
||||
@itemOpened(editor)
|
||||
@activePane.activate() if activatePane
|
||||
editor
|
||||
|
||||
# Public: Synchronously open an editor for the given URI or activate an existing
|
||||
# editor in any pane if one already exists.
|
||||
|
Loading…
Reference in New Issue
Block a user