mirror of
https://github.com/NohamR/Reclass.git
synced 2026-05-10 19:59:21 +00:00
Remove command row leading spaces, add right-click menu in empty area
- Command row text is now flush-left (no 3-space fold prefix) - Right-clicking empty area below nodes shows a limited context menu with "Append 128 bytes" (inserts 16 Hex64 fields at root level) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -38,9 +38,10 @@ struct ComposeState {
|
|||||||
void emitLine(const QString& lineText, LineMeta lm) {
|
void emitLine(const QString& lineText, LineMeta lm) {
|
||||||
if (currentLine > 0) text += '\n';
|
if (currentLine > 0) text += '\n';
|
||||||
// 3-char fold indicator column: " - " expanded, " + " collapsed, " " other
|
// 3-char fold indicator column: " - " expanded, " + " collapsed, " " other
|
||||||
if (lm.lineKind == LineKind::CommandRow)
|
// CommandRow has no fold prefix (flush left)
|
||||||
text += QStringLiteral(" ");
|
if (lm.lineKind == LineKind::CommandRow) {
|
||||||
else if (lm.foldHead)
|
// no prefix
|
||||||
|
} else if (lm.foldHead)
|
||||||
text += lm.foldCollapsed ? QStringLiteral(" + ") : QStringLiteral(" - ");
|
text += lm.foldCollapsed ? QStringLiteral(" + ") : QStringLiteral(" - ");
|
||||||
else
|
else
|
||||||
text += QStringLiteral(" ");
|
text += QStringLiteral(" ");
|
||||||
|
|||||||
@@ -740,7 +740,22 @@ void RcxController::duplicateNode(int nodeIdx) {
|
|||||||
|
|
||||||
void RcxController::showContextMenu(RcxEditor* editor, int line, int nodeIdx,
|
void RcxController::showContextMenu(RcxEditor* editor, int line, int nodeIdx,
|
||||||
int subLine, const QPoint& globalPos) {
|
int subLine, const QPoint& globalPos) {
|
||||||
if (nodeIdx < 0 || nodeIdx >= m_doc->tree.nodes.size()) return;
|
// Empty area or CommandRow: show limited menu
|
||||||
|
if (nodeIdx < 0 || nodeIdx >= m_doc->tree.nodes.size()) {
|
||||||
|
QMenu menu;
|
||||||
|
menu.addAction("Append 128 bytes", [this]() {
|
||||||
|
m_suppressRefresh = true;
|
||||||
|
m_doc->undoStack.beginMacro(QStringLiteral("Append 128 bytes"));
|
||||||
|
for (int i = 0; i < 16; i++)
|
||||||
|
insertNode(0, -1, NodeKind::Hex64,
|
||||||
|
QStringLiteral("field_%1").arg(i));
|
||||||
|
m_doc->undoStack.endMacro();
|
||||||
|
m_suppressRefresh = false;
|
||||||
|
refresh();
|
||||||
|
});
|
||||||
|
menu.exec(globalPos);
|
||||||
|
return;
|
||||||
|
}
|
||||||
uint64_t clickedId = m_doc->tree.nodes[nodeIdx].id;
|
uint64_t clickedId = m_doc->tree.nodes[nodeIdx].id;
|
||||||
|
|
||||||
// Right-click selection policy: if not in selection, select only this node
|
// Right-click selection policy: if not in selection, select only this node
|
||||||
|
|||||||
Reference in New Issue
Block a user