Make discard actually discard, and stop the delete dialog over-promising - #59
Merged
Merged
Conversation
**git 변경 취소.** 디스크는 HEAD 로 되돌리면서 열린 버퍼는 안 건드렸다. 그래서 패널은 "변경 없음" 인데 편집기엔 그 변경이 그대로 남고, 저장하면 방금 버린 것이 되살아난다. 절반만 버린 셈이다. 버리기가 뜻하는 것은 "이 파일의 변경을 전부 없앤다" 이고 저장 안 한 편집도 그 파일의 변경이다. 그래서 함께 버린다 — 다만 되돌릴 수 없으니 확인창에서 미리 말한다. **삭제 확인창.** "휴지통으로 옮길까요?" 라고 묻는데, 휴지통에 들어가는 것은 디스크에 있던 내용뿐이다. 저장 안 한 편집은 버퍼에만 있어서 그대로 사라지고 되돌릴 방법이 없다. 확인창이 되돌릴 수 있다고 약속하는 이상, 그 약속이 닿지 않는 부분은 말해야 한다. 무엇이 함께 사라지는지 파일 이름으로 적는다.
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.
Discard threw away half of what it said
git discardreverts the file on disk to HEAD and leaves the open buffer alone. The panel then shows no changes while the editor still displays them, and saving brings back exactly what was just discarded.Discarding a file means removing that file's changes, and unsaved edits are that file's changes. They now go too — and because that is not reversible, the confirmation says so first.
The delete dialog promised something it could not keep
It asks whether to move to the trash. What goes to the trash is the content that was on disk. Unsaved edits live only in the buffer: they are gone, with nothing to recover from. A dialog that promises reversibility has to say where that promise stops, so it now names the files whose unsaved work will not be in the trash.
Verification
Against a real git repository, with a file carrying both a committed-to-disk change and an unsaved edit on top — 6 of 6:
And with the buffer revert removed:
exp// 저장한 변경 | // 저장안한 변경still sitting in the editor after the discard, which is the original bug reproduced exactly.954 tests,
npm run typecheckclean.