Script Editor: fixed a problem where folded blocks were unfolded unexpectedly when the script was saved. Fixes #392

This commit is contained in:
biwa 2021-03-22 12:11:25 +01:00
parent 6917ded506
commit 6de1d10065

View file

@ -253,8 +253,10 @@ namespace CodeImp.DoomBuilder.Controls
editor.SelectionEnd = selectionEnd; editor.SelectionEnd = selectionEnd;
editor.Scintilla.FirstVisibleLine = vscroll; editor.Scintilla.FirstVisibleLine = vscroll;
// restore folding // Restore folding
for (int i = 0; i < folded.Length; i++) // Looks like that has to be done from back to front, as the end result will otherwise have too much unfolded for
// whatever reason. See https://github.com/jewalky/UltimateDoomBuilder/issues/392
for (int i = folded.Length - 1; i >= 0; i--)
{ {
Line l = editor.Scintilla.Lines[i]; Line l = editor.Scintilla.Lines[i];
l.FoldLevel = folded[i]; l.FoldLevel = folded[i];