Commit a5afffd8 authored by Waqar Ahmed's avatar Waqar Ahmed Committed by Christoph Cullmann
Browse files

Force emit cursorPositionChanged even if cursor was same

parent b3fb485b
...@@ -658,8 +658,16 @@ public: ...@@ -658,8 +658,16 @@ public:
if (event->type() == QEvent::MouseButtonPress) { if (event->type() == QEvent::MouseButtonPress) {
if (mouseEvent->button() == Qt::LeftButton && mouseEvent->modifiers() == Qt::ControlModifier) { if (mouseEvent->button() == Qt::LeftButton && mouseEvent->modifiers() == Qt::ControlModifier) {
// must set cursor else we will be jumping somewhere else!! // must set cursor else we will be jumping somewhere else!!
v->setCursorPosition(cur);
if (!word.isEmpty()) { if (!word.isEmpty()) {
auto existingCur = v->cursorPosition();
v->setCursorPosition(cur);
// hack: if the cursor is same as existing one,
// we force trigger cursorPositionChanged()
if (existingCur == cur) {
Q_EMIT v->cursorPositionChanged(v, cur);
}
m_ctrlHoverFeedback.clear(m_mainWindow->activeView()); m_ctrlHoverFeedback.clear(m_mainWindow->activeView());
goToDefinition(); goToDefinition();
} }
...@@ -1026,12 +1034,22 @@ public: ...@@ -1026,12 +1034,22 @@ public:
KTextEditor::Cursor cdef(line, column); KTextEditor::Cursor cdef(line, column);
if (document && uri == document->url()) { if (document && uri == document->url()) {
auto existingCur = activeView->cursorPosition();
activeView->setCursorPosition(cdef); activeView->setCursorPosition(cdef);
// force emit cursorPositionChanged
if (existingCur == cdef) {
Q_EMIT activeView->cursorPositionChanged(activeView, cdef);
}
highlightLandingLocation(activeView, location); highlightLandingLocation(activeView, location);
} else { } else {
KTextEditor::View *view = m_mainWindow->openUrl(uri); KTextEditor::View *view = m_mainWindow->openUrl(uri);
if (view) { if (view) {
auto existingCur = view->cursorPosition();
view->setCursorPosition(cdef); view->setCursorPosition(cdef);
// force emit cursorPositionChanged
if (existingCur == cdef) {
Q_EMIT activeView->cursorPositionChanged(view, cdef);
}
highlightLandingLocation(view, location); highlightLandingLocation(view, location);
} }
} }
......
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