feat: Vergilius-style C++ generator, struct type click fix, item view highlight fix

Rewrite C++ generator for Vergilius-style output: inline anonymous
structs/unions, reference opaque types by name with struct keyword
prefix, size comments, aligned offset comments, no anon_ stubs.

Fix struct type name not clickable in editor headers (headerTypeNameSpan
assumed "struct TYPENAME" format but named structs use bare name).

Add static_assert toggle in Options > Generator, default off.

Fix item view highlight bleed: patch PE_PanelItemViewRow to use
theme.hover so row background matches CE_ItemViewItem.
This commit is contained in:
IChooseYou
2026-02-26 08:21:15 -07:00
committed by IChooseYou
parent 52f751e751
commit 1465e7fbed
9 changed files with 362 additions and 171 deletions

View File

@@ -2514,6 +2514,48 @@ private slots:
<< QString("gapRight=%1 gapBottom=%2 (font-independent)")
.arg(gapR1).arg(gapB1);
}
// ── Test: hovering struct type name shows PointingHand cursor ──
// Regression: headerTypeNameSpan returned invalid for named structs
// because it assumed "struct TYPENAME" format, but named structs are
// formatted as just "TYPENAME" (e.g. "_STRING64 CSDVersion").
void testStructTypeClickable() {
m_editor->applyDocument(m_result);
QApplication::processEvents();
// Find a named struct header (e.g. _STRING64 CSDVersion from makeTestTree)
int headerLine = -1;
for (int i = 0; i < m_result.meta.size(); i++) {
const auto& lm = m_result.meta[i];
if (lm.lineKind == LineKind::Header && lm.foldHead
&& lm.nodeKind == NodeKind::Struct && !lm.isArrayHeader) {
headerLine = i;
break;
}
}
QVERIFY2(headerLine >= 0, "Should have a struct header");
const LineMeta* lm = m_editor->metaForLine(headerLine);
QVERIFY(lm);
// Scroll to ensure line is visible
m_editor->scintilla()->SendScintilla(
QsciScintillaBase::SCI_ENSUREVISIBLE, (unsigned long)headerLine);
m_editor->scintilla()->SendScintilla(
QsciScintillaBase::SCI_GOTOLINE, (unsigned long)headerLine);
QApplication::processEvents();
// The type column starts at kFoldCol + depth*3
int typeStart = 3 + lm->depth * 3; // kFoldCol = 3
// Hover over type column — should show PointingHandCursor
// (Before fix: showed ArrowCursor because headerTypeNameSpan returned invalid)
QPoint typePos = colToViewport(m_editor->scintilla(), headerLine, typeStart + 1);
QVERIFY2(typePos.y() > 0, "Header line should be visible");
sendMouseMove(m_editor->scintilla()->viewport(), typePos);
QApplication::processEvents();
QCOMPARE(viewportCursor(m_editor), Qt::PointingHandCursor);
}
};
QTEST_MAIN(TestEditor)