mirror of
https://github.com/NohamR/Reclass.git
synced 2026-05-10 19:59:21 +00:00
KindFlags refactor, indicator helpers, auto-padding, sizeof format fix
- Add KindFlags bitmask enum (KF_HexPreview, KF_Container, KF_String, KF_Vector) - Add helper functions: isHexPreview(), flagsFor(), allTypeNamesForUI() - Add editor helpers: clearIndicatorLine(), fillIndicatorCols(), resolvedSpanFor() - Use SCI_FINDCOLUMN for UTF-8 safe column-to-position conversion - Auto-emit hex padding nodes when changing type to smaller size - Fix struct footer format: sizeof(Name)=0x... (no spaces) - Add tests for sizeof recalculation after node deletion - Add debug output to investigate sizeof refresh issue - Replace icons.qrc with resources.qrc, add embedded fonts Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
28
src/editor.h
28
src/editor.h
@@ -37,6 +37,8 @@ public:
|
||||
void cancelInlineEdit();
|
||||
|
||||
void applySelectionOverlay(const QSet<uint64_t>& selIds);
|
||||
void setEditorFont(const QString& fontName);
|
||||
static void setGlobalFontName(const QString& fontName);
|
||||
|
||||
signals:
|
||||
void marginClicked(int margin, int line, Qt::KeyboardModifiers mods);
|
||||
@@ -63,10 +65,17 @@ private:
|
||||
bool m_cursorOverridden = false;
|
||||
uint64_t m_hoveredNodeId = 0;
|
||||
QSet<uint64_t> m_currentSelIds;
|
||||
|
||||
int m_hoverTokLine = -1;
|
||||
EditTarget m_hoverTokTarget = EditTarget::Name;
|
||||
// ── Drag selection ──
|
||||
bool m_dragging = false;
|
||||
int m_dragLastLine = -1;
|
||||
Qt::KeyboardModifiers m_dragInitMods = Qt::NoModifier;
|
||||
|
||||
// ── Deferred click (protects multi-select on double-click) ──
|
||||
uint64_t m_pendingClickNodeId = 0;
|
||||
int m_pendingClickLine = -1;
|
||||
Qt::KeyboardModifiers m_pendingClickMods = Qt::NoModifier;
|
||||
|
||||
// ── Inline edit state ──
|
||||
struct InlineEditState {
|
||||
@@ -78,6 +87,7 @@ private:
|
||||
int spanStart = 0;
|
||||
int linelenAfterReplace = 0;
|
||||
QString original;
|
||||
NodeKind editKind = NodeKind::Int32;
|
||||
};
|
||||
InlineEditState m_editState;
|
||||
|
||||
@@ -94,20 +104,34 @@ private:
|
||||
void applyHexDimming(const QVector<LineMeta>& meta);
|
||||
|
||||
void commitInlineEdit();
|
||||
int editEndCol() const;
|
||||
bool handleNormalKey(QKeyEvent* ke);
|
||||
bool handleEditKey(QKeyEvent* ke);
|
||||
void showTypeAutocomplete();
|
||||
void updateEditableUnderline(int line);
|
||||
void paintEditableSpans(int line);
|
||||
void updateEditableIndicators(int line);
|
||||
void applyHoverCursor();
|
||||
void applyHoverHighlight();
|
||||
void updateEditTokenBox();
|
||||
void validateEditLive();
|
||||
void showEditValidation(bool valid);
|
||||
|
||||
// ── Refactored helpers ──
|
||||
struct HitInfo { int line = -1; int col = -1; uint64_t nodeId = 0; bool inFoldCol = false; };
|
||||
HitInfo hitTest(const QPoint& viewportPos) const;
|
||||
|
||||
struct EndEditInfo { int nodeIdx; int subLine; EditTarget target; };
|
||||
EndEditInfo endInlineEdit();
|
||||
|
||||
struct NormalizedSpan { int start = 0; int end = 0; bool valid = false; };
|
||||
NormalizedSpan normalizeSpan(const ColumnSpan& raw, const QString& lineText,
|
||||
EditTarget target, bool skipPrefixes) const;
|
||||
|
||||
// ── Indicator helpers (dedupe + UTF-8 safe) ──
|
||||
void clearIndicatorLine(int indic, int line);
|
||||
void fillIndicatorCols(int indic, int line, int colA, int colB);
|
||||
bool resolvedSpanFor(int line, EditTarget t, NormalizedSpan& out,
|
||||
QString* lineTextOut = nullptr) const;
|
||||
};
|
||||
|
||||
} // namespace rcx
|
||||
|
||||
Reference in New Issue
Block a user