-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix FileViewer's encoding bug when showing unstaged files #11960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
p.s. currently HEX view of binary files is broken when they are staged, that is this was already broken before this PR and this PR doesn't do anything to fix it. That fix will come later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, have not run
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have not run
Fixes #11934
A bigger issue than originally mentioned in #11934 is that currently TextEditor provided/used by GitExtensions actually corrupts files 😬
Proposed changes
FilePreamble = reader.CurrentEncoding.GetPreamble();
MemoryStream
when not necessary and we can write straight toFileStream
Screenshots
Before
Switching between UTF8 file without BOM and with BOM
no-bom-display-bug.mp4
After save using⚠️ ⚠️ ⚠️ notice corruption in a file without BOM
fileeditor
(F4
from within commit dialog)no-bom-save-corruption-bug.mp4
After
Both files even after saving them with
fileeditor
(F4
from within commit dialog) are recognized as UTF8no-bom-save-corruption-fix.mp4
Test methodology
Test environment(s)
Merge strategy
I agree that the maintainer squash merge this PR (if the commit message is clear).
✒️ I contribute this code under The Developer Certificate of Origin.