mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Refactor pending state to live in pane instead of items
* New public API `workspace.setItemNotPending` that
packages can use to set an item to set an item to not pending
(e.g. when the user interacts with the item)
* Pending state for newly opened items with `{pending: true}`
is now tracked by `Pane` instead of the item, and packages like
`tabs` that query this information now get it from the Pane.
This commit is contained in:
@@ -477,7 +477,7 @@ class Workspace extends Model
|
||||
|
||||
if uri?
|
||||
if item = pane.itemForURI(uri)
|
||||
item.terminatePendingState?() if item.isPending?() and not options.pending
|
||||
pane.setPendingItem(null) if not options.pending
|
||||
item ?= opener(uri, options) for opener in @getOpeners() when not item
|
||||
|
||||
try
|
||||
@@ -500,7 +500,7 @@ class Workspace extends Model
|
||||
return item if pane.isDestroyed()
|
||||
|
||||
@itemOpened(item)
|
||||
pane.activateItem(item) if activateItem
|
||||
pane.activateItem(item, options.pending) if activateItem
|
||||
pane.activate() if activatePane
|
||||
|
||||
initialLine = initialColumn = 0
|
||||
@@ -515,6 +515,12 @@ class Workspace extends Model
|
||||
@emitter.emit 'did-open', {uri, pane, item, index}
|
||||
item
|
||||
|
||||
setItemNotPending: (item) =>
|
||||
for pane in @getPanes()
|
||||
if item is pane.getPendingItem()
|
||||
pane.setPendingItem(null)
|
||||
break
|
||||
|
||||
openTextFile: (uri, options) ->
|
||||
filePath = @project.resolvePath(uri)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user