A file is considered modified even if contents are the same as before any modifications #11296
-
SummaryI expect no indicator showing file change if the file content is the same as the buffer content. This is not always the case. Let us have Helix open on a save file, nothing is modified. Then, doing some change, and formatting with Reproduction Steps
Helix logI don't think it will be useful, but here is ~/.cache/helix/helix.log
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
Thus is intentional behavior, the modification indicator does not indicate whether a file is incidentally the same as another file but whether the document in undo history that was saved to/read from disk. |
Beta Was this translation helpful? Give feedback.
Our behavior matches NeoVim, Kakoune and VSCode. We don't do what you propose for the same reason as the other editors: it's expensive. In order to reset the modification indicator when the buffer matches the underlying file you need to compare the buffer to on-disk contents per change which is very wasteful resource-wise regardless of file size, but especially for large files. #4994 is about using file system notifications to rerun the diff detection (via gix). Even if you used file-system notifications to detect when the underlying file changed you would need to keep a copy of the file in memory for comparisons.