fix(editor): don't save stale text over a file replaced by binary content (#6840)

reload_from_disk treated a file that now loads as binary like a document opened as binary: it refreshed the disk stamp without a disk-change report, so autosave wrote the next edit over the binary file. A detected-encoding buffer now gets the disk conflict too. Reopening a file whose closed tab kept unsaved changes shows that buffer as text instead of a binary viewer that hid what Save would write. A clean buffer gets its own disk-change wording.

Co-authored-by: audichuang <[email protected]>
Цей коміт міститься в:
audichuang authored and GitHub committed 2026-11-29 21:34:53 +08:00
1 джерело 3d6ad2e254
коміт 08eb9e3ff9
6 files changed
+105 -12

No files matched your search

+1
Переглянути файл
@@ -3878,6 +3878,7 @@
"Managed in {location}": "Managed in {location}",
"{name} changed on disk": "{name} changed on disk",
"The file was changed outside the IDE while it has unsaved changes in the editor. Saving keeps the editor's version and overwrites the file.": "The file was changed outside the IDE while it has unsaved changes in the editor. Saving keeps the editor's version and overwrites the file.",
"The file was replaced outside the IDE with content that can't be shown as text. Saving keeps the editor's version and overwrites the file.": "The file was replaced outside the IDE with content that can't be shown as text. Saving keeps the editor's version and overwrites the file.",
"Load Changes from Disk": "Load Changes from Disk",
"Keep Editor Changes": "Keep Editor Changes",
"Branches have diverged": "Branches have diverged",
+1
Переглянути файл
@@ -10388,6 +10388,7 @@
"Managed in {location}": "由 {location} 管理",
"{name} changed on disk": "{name} 已在磁盘上更改",
"The file was changed outside the IDE while it has unsaved changes in the editor. Saving keeps the editor's version and overwrites the file.": "该文件在 IDE 外被修改,而编辑器中还有未保存的更改。保存会保留编辑器中的版本并覆盖该文件。",
"The file was replaced outside the IDE with content that can't be shown as text. Saving keeps the editor's version and overwrites the file.": "该文件在 IDE 外被替换为无法以文本显示的内容。保存会保留编辑器中的版本并覆盖该文件。",
"Load Changes from Disk": "从磁盘加载更改",
"Keep Editor Changes": "保留编辑器中的更改",
"Diagnose with Agent": "用智能体诊断",