Skip to content

Commit

Permalink
Fixed inconsistent behavior with modified flag + Unsaved
Browse files Browse the repository at this point in the history
  • Loading branch information
halvarsson committed Apr 26, 2024
1 parent f55357f commit c0fc952
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ShowEditorCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,11 @@ private void Format()
textEditor.Format();
if (textEditor.Text != _originalText)
{
fileNameStatus.Title += "*";
textEditor.modified = true;
if (!fileNameStatus.Title.EndsWith("*"))
{
fileNameStatus.Title += "*";
textEditor.modified = true;
}
}
else
{
Expand Down Expand Up @@ -298,6 +301,7 @@ private void LoadFile()
textEditor.modified = false;
_originalText = textEditor.Text.ToByteArray();
_fileName = System.IO.Path.GetFileName(Path);
currentDirectory = System.IO.Path.GetDirectoryName(Path);
fileNameStatus.Title = _fileName;
SetLanguage(Path);
if (statusBar != null)
Expand Down Expand Up @@ -390,6 +394,7 @@ private void New()
return;
}
fileNameStatus.Title = "Unsaved";
_fileName = "Unsaved";
Path = null;
_originalText = new System.IO.MemoryStream().ToArray();
textEditor.Text = _originalText;
Expand Down

0 comments on commit c0fc952

Please sign in to comment.