Unchanged script editor skips implicit save (#543)

Stop calling ScriptFileDocumentTab.RemoveTrailingWhitespace()
on a text editor that has unchanged text. This causes the
currently-opened map to be marked 'isChanged == true' when
nothing is modified.
This commit is contained in:
Derek MacDonald 2021-04-06 14:38:48 -04:00 committed by GitHub
parent 6c8a3cb50b
commit f693959df4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -73,6 +73,7 @@ namespace CodeImp.DoomBuilder.Controls
{
editor.SetText(stream.ToArray()); //mxd
editor.ClearUndoRedo();
editor.SetSavePoint();
}
// Set title
@ -108,6 +109,8 @@ namespace CodeImp.DoomBuilder.Controls
// Implicit save
public override bool Save()
{
if (!editor.IsChanged) return false;
// [ZZ] remove trailing whitespace
RemoveTrailingWhitespace();

View file

@ -48,6 +48,7 @@ namespace CodeImp.DoomBuilder.Controls
editor.SetText(stream.ToArray());
editor.Scintilla.ReadOnly = source.IsReadOnly;
editor.ClearUndoRedo();
editor.SetSavePoint();
}
else
{
@ -92,7 +93,7 @@ namespace CodeImp.DoomBuilder.Controls
// Return true when successfully saved
public override bool Save()
{
if(source.IsReadOnly) return false;
if(source.IsReadOnly || !editor.IsChanged) return false;
// [ZZ] remove trailing whitespace
RemoveTrailingWhitespace();