Fix issue where isDeleted incorrectly returned true…#15
Open
savetheclocktower wants to merge 2 commits into
Open
Fix issue where isDeleted incorrectly returned true…#15savetheclocktower wants to merge 2 commits into
isDeleted incorrectly returned true…#15savetheclocktower wants to merge 2 commits into
Conversation
…when a buffer is newly created and set to a path that does not yet exist on disk.
This was referenced May 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…when a buffer is newly created and set to a path that does not yet exist on disk.
This is something I screwed up on #13. To track a buffer’s “deleted” state — meaning “is not currently backed by a file on disk, but was at one point” — we keep a
didHaveFileOnDiskproperty and change it as needed.In
TextBuffer::load, I unconditionally setbecause I suppose I thought that the
loadmethod would always be loading a file from disk. But there are use cases for callingloadwhen the buffer’sfileinstance is set to a nonexistent path.The above snippet creates a new buffer much the way it would if you'd simply said
new TextBuffer— but it already knows where it will save once you ask it to save itself. So inTextBuffer::load(called by the staticTextBuffer.load) we must setdidHaveFileOnDiskbased on whether the file actually exists instead of assumingtrue.Easy to modify an existing spec to do a sanity-check here.
This is why pulsar#1588 is still in draft; this regression caused an
autosavespec to fail. Gotta land this fix and then bumptext-bufferagain before that PR is ready to come out of draft.