mirror of
https://github.com/NohamR/Reclass.git
synced 2026-05-10 19:59:21 +00:00
Copy All as Text now includes margin offset text prepended to each line
This commit is contained in:
@@ -1184,7 +1184,7 @@ void RcxController::showContextMenu(RcxEditor* editor, int line, int nodeIdx,
|
|||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
|
|
||||||
menu.addAction(icon("clippy.svg"), "Copy All as Text", [editor]() {
|
menu.addAction(icon("clippy.svg"), "Copy All as Text", [editor]() {
|
||||||
QApplication::clipboard()->setText(editor->scintilla()->text());
|
QApplication::clipboard()->setText(editor->textWithMargins());
|
||||||
});
|
});
|
||||||
|
|
||||||
menu.exec(globalPos);
|
menu.exec(globalPos);
|
||||||
|
|||||||
@@ -2154,4 +2154,18 @@ void RcxEditor::setGlobalFontName(const QString& fontName) {
|
|||||||
g_fontName = fontName;
|
g_fontName = fontName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString RcxEditor::textWithMargins() const {
|
||||||
|
int lineCount = (int)m_sci->SendScintilla(QsciScintillaBase::SCI_GETLINECOUNT);
|
||||||
|
QStringList lines;
|
||||||
|
lines.reserve(lineCount);
|
||||||
|
for (int i = 0; i < lineCount; i++) {
|
||||||
|
QString margin;
|
||||||
|
if (i < m_meta.size())
|
||||||
|
margin = m_meta[i].offsetText;
|
||||||
|
QString lineText = getLineText(m_sci, i);
|
||||||
|
lines.append(margin + lineText);
|
||||||
|
}
|
||||||
|
return lines.join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace rcx
|
} // namespace rcx
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ public:
|
|||||||
static void setGlobalFontName(const QString& fontName);
|
static void setGlobalFontName(const QString& fontName);
|
||||||
|
|
||||||
// Custom type names (struct types from the tree) shown in type picker + lexer GlobalClass coloring
|
// Custom type names (struct types from the tree) shown in type picker + lexer GlobalClass coloring
|
||||||
|
QString textWithMargins() const;
|
||||||
void setCustomTypeNames(const QStringList& names);
|
void setCustomTypeNames(const QStringList& names);
|
||||||
|
|
||||||
// Saved sources for quick-switch in source picker
|
// Saved sources for quick-switch in source picker
|
||||||
|
|||||||
Reference in New Issue
Block a user