Skip to content

Enhance deleted state#13

Draft
savetheclocktower wants to merge 4 commits intomasterfrom
enhance-deleted-state
Draft

Enhance deleted state#13
savetheclocktower wants to merge 4 commits intomasterfrom
enhance-deleted-state

Conversation

@savetheclocktower
Copy link
Copy Markdown

(This builds on work done in #11; I'll keep this PR in draft until that one lands.)

Issue or RFC Endorsed by Atom's Maintainers

#12

Description of the Change

This improves handling of a “deleted” buffer state as follows:

  • Distinguishes it from buffers that never had a backing file on disk; isDeleted is now a state that can be queried just like isModified or isInConflict.
  • Changes isModified so that it no longer automatically returns true if the buffer's file doesn't exist. Instead, it returns false if the buffer was unmodified at time of deletion, as long as no subsequent edits have been made. Otherwise, it returns true in all scenarios in which it would've previously returned true.

This allows us to get closer to VS Code's behavior with deleted files: allow the user to remove their tab from the workspace without an unnecessary “are you sure?” prompt.

Alternate Designs

#12 outlines the two possible designs. I went with the first one because it's more elegant.

Possible Drawbacks

There could be unintended side effects of narrowing the definition of isModified for one specific kind of pane item. I haven't found any yet, but we should keep an eye on this.

Verification Process

New unit tests.

Release Notes

  • [text-buffer] Enhance “deleted” state to distinguish whether the buffer was in a modified state during time of file deletion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant