mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Store relative buffer path instead of id
This allows the tokenized buffer to be deserialized during reopening from the pane container. Closes #744
This commit is contained in:
@@ -109,6 +109,15 @@ describe "PaneContainer", ->
|
||||
expect(container.reopenItem()).toBeFalsy()
|
||||
expect(pane1.activeItem).toEqual item3
|
||||
|
||||
describe "when the last-closed pane item is an edit session", ->
|
||||
it "reopens the edit session (regression)", ->
|
||||
editSession = project.open('sample.js')
|
||||
pane3.showItem(editSession)
|
||||
pane3.destroyItem(editSession)
|
||||
expect(container.reopenItem()).toBeTruthy()
|
||||
expect(pane3.activeItem.getPath()).toBe editSession.getPath()
|
||||
expect(container.reopenItem()).toBeFalsy()
|
||||
|
||||
describe "when there is no active pane", ->
|
||||
it "attaches a new pane with the reconstructed last pane item and focuses it", ->
|
||||
container.attachToDom()
|
||||
|
||||
@@ -27,12 +27,12 @@ class TokenizedBuffer
|
||||
constructor: (optionsOrState) ->
|
||||
if optionsOrState instanceof telepath.Document
|
||||
@state = optionsOrState
|
||||
@buffer = project.bufferForId(optionsOrState.get('bufferId'))
|
||||
@buffer = project.bufferForPath(optionsOrState.get('bufferPath'))
|
||||
else
|
||||
{ @buffer, tabLength } = optionsOrState
|
||||
@state = site.createDocument
|
||||
deserializer: @constructor.name
|
||||
bufferId: @buffer.id
|
||||
bufferPath: @buffer.getRelativePath()
|
||||
tabLength: tabLength ? 2
|
||||
|
||||
@subscribe syntax, 'grammar-added grammar-updated', (grammar) =>
|
||||
@@ -44,6 +44,7 @@ class TokenizedBuffer
|
||||
|
||||
@on 'grammar-changed grammar-updated', => @resetTokenizedLines()
|
||||
@subscribe @buffer, "changed", (e) => @handleBufferChange(e)
|
||||
@subscribe @buffer, "path-changed", => @state.set('bufferPath', @buffer.getRelativePath())
|
||||
|
||||
@reloadGrammar()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user