Commit 7391ba38 authored by con's avatar con
Browse files

Fix navigation history issues.

Separating navigation history logic from updating of highlights.
parent f133d0ac
...@@ -223,7 +223,7 @@ BaseTextEditor::BaseTextEditor(QWidget *parent) ...@@ -223,7 +223,7 @@ BaseTextEditor::BaseTextEditor(QWidget *parent)
d->m_searchResultFormat.setBackground(QColor(0xffef0b)); d->m_searchResultFormat.setBackground(QColor(0xffef0b));
slotUpdateExtraAreaWidth(); slotUpdateExtraAreaWidth();
slotCursorPositionChanged(); updateHighlights();
setFrameStyle(QFrame::NoFrame); setFrameStyle(QFrame::NoFrame);
d->m_delayedUpdateTimer = new QTimer(this); d->m_delayedUpdateTimer = new QTimer(this);
...@@ -3198,7 +3198,11 @@ void BaseTextEditor::slotCursorPositionChanged() ...@@ -3198,7 +3198,11 @@ void BaseTextEditor::slotCursorPositionChanged()
} else if (d->m_contentsChanged) { } else if (d->m_contentsChanged) {
saveCurrentCursorPositionForNavigation(); saveCurrentCursorPositionForNavigation();
} }
updateHighlights();
}
void BaseTextEditor::updateHighlights()
{
if (d->m_parenthesesMatchingEnabled && hasFocus()) { if (d->m_parenthesesMatchingEnabled && hasFocus()) {
// Delay update when no matching is displayed yet, to avoid flicker // Delay update when no matching is displayed yet, to avoid flicker
if (extraSelections(ParenthesesMatchingSelection).isEmpty() if (extraSelections(ParenthesesMatchingSelection).isEmpty()
...@@ -4774,7 +4778,7 @@ void BaseTextEditor::changeEvent(QEvent *e) ...@@ -4774,7 +4778,7 @@ void BaseTextEditor::changeEvent(QEvent *e)
void BaseTextEditor::focusInEvent(QFocusEvent *e) void BaseTextEditor::focusInEvent(QFocusEvent *e)
{ {
QPlainTextEdit::focusInEvent(e); QPlainTextEdit::focusInEvent(e);
slotCursorPositionChanged(); updateHighlights();
} }
void BaseTextEditor::focusOutEvent(QFocusEvent *e) void BaseTextEditor::focusOutEvent(QFocusEvent *e)
...@@ -5157,7 +5161,7 @@ void BaseTextEditor::setDisplaySettings(const DisplaySettings &ds) ...@@ -5157,7 +5161,7 @@ void BaseTextEditor::setDisplaySettings(const DisplaySettings &ds)
d->m_highlightBlocksInfo = BaseTextEditorPrivateHighlightBlocks(); d->m_highlightBlocksInfo = BaseTextEditorPrivateHighlightBlocks();
} }
slotCursorPositionChanged(); updateHighlights();
viewport()->update(); viewport()->update();
extraArea()->update(); extraArea()->update();
} }
......
...@@ -626,6 +626,7 @@ private: ...@@ -626,6 +626,7 @@ private:
void moveLineUpDown(bool up); void moveLineUpDown(bool up);
void copyLineUpDown(bool up); void copyLineUpDown(bool up);
void saveCurrentCursorPositionForNavigation(); void saveCurrentCursorPositionForNavigation();
void updateHighlights();
void updateCurrentLineHighlight(); void updateCurrentLineHighlight();
void drawFoldingMarker(QPainter *painter, const QPalette &pal, void drawFoldingMarker(QPainter *painter, const QPalette &pal,
......
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