mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Keep saved collapse data from collapsing around the cursor
This commit is contained in:
parent
3739020504
commit
de4269bf32
1 changed files with 13 additions and 4 deletions
|
@ -6078,7 +6078,7 @@ namespace IDE.ui
|
|||
wantOpen = !wantOpen;
|
||||
|
||||
if (collapseEntry.mIsOpen != wantOpen)
|
||||
SetCollapseOpen(@collapseEntry.Index, wantOpen, true);
|
||||
SetCollapseOpen(@collapseEntry.Index, wantOpen, true, true);
|
||||
}
|
||||
|
||||
mCollapseAwaitingDB = false;
|
||||
|
@ -6387,18 +6387,27 @@ namespace IDE.ui
|
|||
}
|
||||
|
||||
|
||||
public void SetCollapseOpen(int collapseIdx, bool wantOpen, bool immediate = false)
|
||||
public void SetCollapseOpen(int collapseIdx, bool wantOpen, bool immediate = false, bool keepCursorVisible = false)
|
||||
{
|
||||
var entry = mOrderedCollapseEntries[collapseIdx];
|
||||
|
||||
var cursorLineAndColumn = CursorLineAndColumn;
|
||||
|
||||
if ((!wantOpen) && (keepCursorVisible) && (cursorLineAndColumn.mLine >= entry.mStartLine) && (cursorLineAndColumn.mLine <= entry.mEndLine))
|
||||
{
|
||||
if (CursorTextPos < entry.mEndIdx)
|
||||
{
|
||||
// Ignore close
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
entry.mIsOpen = wantOpen;
|
||||
if (immediate)
|
||||
entry.mOpenPct = entry.mIsOpen ? 1.0f : 0.0f;
|
||||
mCollapseNeedsUpdate = true;
|
||||
mCollapseDBDirty = true;
|
||||
|
||||
var cursorLineAndColumn = CursorLineAndColumn;
|
||||
|
||||
if (wantOpen)
|
||||
{
|
||||
if (mEmbeds.GetValue(entry.mAnchorLine) case .Ok(let embed))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue