1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +02:00

Serialize IDE collapse state

This commit is contained in:
Brian Fiete 2022-07-12 05:53:22 -04:00
parent aa58c864f7
commit 4c2530e227
4 changed files with 224 additions and 6 deletions

View file

@ -6951,6 +6951,36 @@ namespace IDE.ui
// Process after mQueuedCollapseData so mCharIdSpan is still valid
ProcessDeferredResolveResults(0);
if (ewc.mCollapseDBDirty)
{
MemoryStream memStream = scope .();
String text = scope .();
mEditWidget.GetText(text);
var hash = MD5.Hash(.((uint8*)text.Ptr, text.Length));
memStream.Write(hash);
bool hadData = false;
for (var kv in ewc.mOrderedCollapseEntries)
{
if (kv.mIsOpen != kv.DefaultOpen)
{
hadData = true;
memStream.Write(kv.mAnchorIdx);
}
}
String filePath = scope .(mFilePath);
IDEUtils.MakeComparableFilePath(filePath);
if (!hadData)
gApp.mFileRecovery.DeleteDB(filePath);
else
gApp.mFileRecovery.SetDB(filePath, memStream.Memory);
ewc.mCollapseDBDirty = false;
}
}
public override void UpdateF(float updatePct)