mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 20:42:21 +02:00
Improved display of anchorless collapses
This commit is contained in:
parent
4df1254743
commit
5fc95f8f07
2 changed files with 15 additions and 9 deletions
|
@ -152,7 +152,7 @@ namespace IDE.ui
|
|||
if (rect.mHeight >= DarkTheme.sDarkTheme.mSmallBoldFont.GetLineSpacing())
|
||||
g.SetFont(DarkTheme.sDarkTheme.mSmallBoldFont);
|
||||
|
||||
if (mEditWidgetContent.mSelection != null)
|
||||
if ((mEditWidgetContent.mSelection != null) && (mCollapseIndex < mEditWidgetContent.mOrderedCollapseEntries.Count))
|
||||
{
|
||||
var collapseEntry = mEditWidgetContent.mOrderedCollapseEntries[mCollapseIndex];
|
||||
if ((mEditWidgetContent.mSelection.Value.MinPos <= collapseEntry.mEndIdx) && (mEditWidgetContent.mSelection.Value.MaxPos >= collapseEntry.mStartIdx))
|
||||
|
@ -228,7 +228,8 @@ namespace IDE.ui
|
|||
}
|
||||
else if (mAnchorLine == mStartLine)
|
||||
{
|
||||
mStartLine++;
|
||||
if (mAnchorId != mStartId)
|
||||
mStartLine++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9183,7 +9183,7 @@ BF_EXPORT const char* BF_CALLTYPE BfCompiler_GetCollapseRegions(BfCompiler* bfCo
|
|||
if ((node->mTriviaStart != mEndSeriesIdx + 1) || (kind != mSeriesKind))
|
||||
{
|
||||
// Flush
|
||||
ConditionalAdd(mStartSeriesIdx, mStartSeriesIdx, mEndSeriesIdx, mSeriesKind);
|
||||
Add(mStartSeriesIdx, mStartSeriesIdx, mEndSeriesIdx, mSeriesKind);
|
||||
mStartSeriesIdx = node->mSrcStart;
|
||||
}
|
||||
}
|
||||
|
@ -9197,11 +9197,11 @@ BF_EXPORT const char* BF_CALLTYPE BfCompiler_GetCollapseRegions(BfCompiler* bfCo
|
|||
void FlushSeries()
|
||||
{
|
||||
if (mStartSeriesIdx != -1)
|
||||
ConditionalAdd(mStartSeriesIdx, mStartSeriesIdx, mEndSeriesIdx, mSeriesKind);
|
||||
Add(mStartSeriesIdx, mStartSeriesIdx, mEndSeriesIdx, mSeriesKind);
|
||||
mStartSeriesIdx = -1;
|
||||
}
|
||||
|
||||
void ConditionalAdd(int anchor, int start, int end, char kind = '?')
|
||||
void Add(int anchor, int start, int end, char kind = '?')
|
||||
{
|
||||
bool isMultiline = false;
|
||||
for (int i = start; i < end; i++)
|
||||
|
@ -9225,9 +9225,7 @@ BF_EXPORT const char* BF_CALLTYPE BfCompiler_GetCollapseRegions(BfCompiler* bfCo
|
|||
return;
|
||||
if (!mStartsFound.Add(start->mSrcStart))
|
||||
return;
|
||||
char str[1024];
|
||||
sprintf(str, "%c%d,%d,%d\n", kind, anchor->mSrcStart, start->mSrcStart, end->mSrcStart);
|
||||
mOutString.Append(str);
|
||||
Add(anchor->mSrcStart, start->mSrcStart, end->mSrcStart, kind);
|
||||
}
|
||||
|
||||
void Add(BfAstNode* anchor, BfAstNode* body, char kind = '?')
|
||||
|
@ -9367,6 +9365,13 @@ BF_EXPORT const char* BF_CALLTYPE BfCompiler_GetCollapseRegions(BfCompiler* bfCo
|
|||
|
||||
BfElementVisitor::Visit(block);
|
||||
}
|
||||
|
||||
virtual void Visit(BfInitializerExpression* initExpr) override
|
||||
{
|
||||
Add(initExpr->mOpenBrace, initExpr->mOpenBrace, initExpr->mCloseBrace);
|
||||
|
||||
BfElementVisitor::Visit(initExpr);
|
||||
}
|
||||
};
|
||||
|
||||
CollapseVisitor collapseVisitor(bfParser, outString);
|
||||
|
@ -9382,7 +9387,7 @@ BF_EXPORT const char* BF_CALLTYPE BfCompiler_GetCollapseRegions(BfCompiler* bfCo
|
|||
{
|
||||
if ((ignoredSectionStart != -1) && (prevPreprocessorNode != NULL) && (prevPreprocessorNode->mCommand != NULL))
|
||||
{
|
||||
collapseVisitor.ConditionalAdd(prevPreprocessorNode->mCommand->mSrcStart, ignoredSectionStart, preprocessorNode->mSrcEnd - 1);
|
||||
collapseVisitor.Add(prevPreprocessorNode->mCommand->mSrcStart, ignoredSectionStart, preprocessorNode->mSrcEnd - 1);
|
||||
ignoredSectionStart = -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue