Fix title bar showing *Untitled on startup with no file to reopen#11578
Merged
niksedk merged 1 commit intoJun 13, 2026
Merged
Conversation
_changeSubtitleHash was initialized to -1, but GetFastHash() never returns -1, so UpdateTitleStatus() always saw a mismatch and prepended '*' before the user made any changes. Seed both hashes from the actual initial state immediately after SelectedEncoding is set.
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.
Summary
When launching the app with no recent file to reopen, the title bar incorrectly showed *Untitled — the asterisk that normally indicates unsaved changes — even though nothing had been modified.
Root Cause
_changeSubtitleHash was field-initialized to -1, but GetFastHash() never returns -1 (it computes a hash seeded from 17). The slow timer fires UpdateTitleStatus() shortly after startup and sees _changeSubtitleHash (-1) != GetFastHash(), treating the clean initial state as modified.
_changeSubtitleHash only gets a real value inside ResetSubtitle(), which is called when opening a file or clicking File > New — never during a cold start with no file.
Fix
Seed both _changeSubtitleHash and _changeSubtitleHashOriginal from the actual initial state in the constructor, immediately after SelectedEncoding is set (the encoding is an input to the hash).
SelectedEncoding = Encodings.FirstOrDefault(...) ?? Encodings[0];
_changeSubtitleHash = GetFastHash();
_changeSubtitleHashOriginal = GetFastHashOriginal();
Testing