Commit 480c9a5b authored by mae's avatar mae

refactor rename selections

the new approach makes it possible to use more edit features
inside the rename selection like cut/copy/paste. Furthermore
it compresses rename operations better on the undo stack.
parent 48a555d7
This diff is collapsed.
......@@ -191,6 +191,9 @@ public:
bool isOutdated() const;
SemanticInfo semanticInfo() const;
virtual void paste(); // reimplemented from BaseTextEditor
virtual void cut(); // reimplemented from BaseTextEditor
public Q_SLOTS:
virtual void setFontSettings(const TextEditor::FontSettings &);
void setSortedMethodOverview(bool sort);
......@@ -269,6 +272,8 @@ private:
const QTextEdit::ExtraSelection &currentRenameSelection,
QTextCursor cursor,
const QString &text = QString());
void startRename();
void finishRename();
void abortRename();
Link findLinkAt(const QTextCursor &, bool resolveTarget = true);
......@@ -292,7 +297,9 @@ private:
QList<QTextEdit::ExtraSelection> m_renameSelections;
int m_currentRenameSelection;
bool m_inRename;
bool m_inRename, m_inRenameChanged, m_firstRenameChange;
QTextCursor m_currentRenameSelectionBegin;
QTextCursor m_currentRenameSelectionEnd;
mutable bool m_allowSkippingOfBlockEnd;
......@@ -4349,7 +4349,10 @@ void BaseTextEditor::setExtraSelections(ExtraSelectionKind kind, const QList<QTe
if (kind == CodeSemanticsSelection) {
foreach (const QTextEdit::ExtraSelection &selection, d->m_extraSelections[kind]) {
d->m_overlay->addOverlaySelection(selection.cursor, selection.format.background().color(), true);
......@@ -377,8 +377,8 @@ public:
public slots:
void setDisplayName(const QString &title);
void paste();
void cut();
virtual void paste();
virtual void cut();
void zoomIn(int range = 1);
void zoomOut(int range = 1);
......@@ -83,11 +83,8 @@ void TextEditorOverlay::addOverlaySelection(int begin, int end,
selection.m_fg = fg;
selection.m_bg = bg;
selection.m_cursor_begin = QTextCursor(document);
selection.m_cursor_end = QTextCursor(document);
selection.m_cursor_begin = QTextCursor(document->docHandle(), begin);
selection.m_cursor_end = QTextCursor(document->docHandle(), end);
if (lockSize)
selection.m_fixedLength = (end - begin);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment