Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Kate
Commits
a722a83a
Commit
a722a83a
authored
Mar 02, 2021
by
Waqar Ahmed
Committed by
Christoph Cullmann
Mar 04, 2021
Browse files
Just use cursorPositionChanged for jumping, no signals
parent
3cb05466
Changes
4
Hide whitespace changes
Inline
Side-by-side
addons/lspclient/lspclientpluginview.cpp
View file @
a722a83a
...
...
@@ -409,11 +409,6 @@ Q_SIGNALS:
*/
void
message
(
const
QVariantMap
&
message
);
/**
* Signal that we jumped to a location
*/
void
jumped
(
const
QUrl
&
url
,
KTextEditor
::
Cursor
c
);
public:
LSPClientActionView
(
LSPClientPlugin
*
plugin
,
KTextEditor
::
MainWindow
*
mainWin
,
KXMLGUIClient
*
client
,
QSharedPointer
<
LSPClientServerManager
>
serverManager
)
:
QObject
(
mainWin
)
...
...
@@ -1030,14 +1025,6 @@ public:
KTextEditor
::
Document
*
document
=
activeView
->
document
();
KTextEditor
::
Cursor
cdef
(
line
,
column
);
// tell Kate we are jumping "from" this location
if
(
document
)
{
Q_EMIT
jumped
(
document
->
url
(),
activeView
->
cursorPosition
());
}
// tell Kate we are jumping "to" this location
Q_EMIT
jumped
(
uri
,
cdef
);
if
(
document
&&
uri
==
document
->
url
())
{
activeView
->
setCursorPosition
(
cdef
);
highlightLandingLocation
(
activeView
,
location
);
...
...
@@ -2428,7 +2415,6 @@ public:
m_mainWindow
->
guiFactory
()
->
addClient
(
this
);
connect
(
m_actionView
.
get
(),
&
LSPClientActionView
::
message
,
this
,
&
LSPClientPluginViewImpl
::
message
);
connect
(
m_actionView
.
get
(),
&
LSPClientActionView
::
jumped
,
this
,
&
LSPClientPluginViewImpl
::
jumped
);
}
~
LSPClientPluginViewImpl
()
override
...
...
@@ -2449,11 +2435,6 @@ Q_SIGNALS:
* @param message outgoing message we send to the host application
*/
void
message
(
const
QVariantMap
&
message
);
/**
* Signal that we jumped to a location
*/
void
jumped
(
const
QUrl
&
url
,
KTextEditor
::
Cursor
c
);
};
QObject
*
LSPClientPluginView
::
new_
(
LSPClientPlugin
*
plugin
,
KTextEditor
::
MainWindow
*
mainWin
)
...
...
kate/katemainwindow.cpp
View file @
a722a83a
...
...
@@ -1183,6 +1183,12 @@ QObject *KateMainWindow::pluginView(const QString &name)
void
KateMainWindow
::
addJump
(
QUrl
url
,
KTextEditor
::
Cursor
c
)
{
// we are in the middle of jumps somewhere?
if
(
!
m_locations
.
isEmpty
()
&&
currentLocation
+
1
<
m_locations
.
size
())
{
// erase all forward history
m_locations
.
remove
(
currentLocation
+
1
,
m_locations
.
size
()
-
(
currentLocation
+
1
));
// this is our new forward
}
m_locations
.
push_back
({
url
,
c
});
// set to last
currentLocation
=
m_locations
.
size
()
-
1
;
...
...
@@ -1254,7 +1260,7 @@ void KateMainWindow::goBack()
if
(
m_locations
.
isEmpty
()
||
currentLocation
==
0
)
{
return
;
}
auto
location
=
m_locations
.
at
(
currentLocation
-
1
);
const
auto
&
location
=
m_locations
.
at
(
currentLocation
-
1
);
currentLocation
--
;
if
(
!
location
.
url
.
isValid
()
||
!
location
.
cursor
.
isValid
())
{
...
...
@@ -1269,7 +1275,14 @@ void KateMainWindow::goBack()
return
;
}
if
(
activeView
()
&&
activeView
()
->
document
()
&&
activeView
()
->
document
()
->
url
()
==
location
.
url
)
{
const
QSignalBlocker
blocker
(
activeView
());
activeView
()
->
setCursorPosition
(
location
.
cursor
);
return
;
}
auto
v
=
openUrl
(
location
.
url
);
const
QSignalBlocker
blocker
(
v
);
v
->
setCursorPosition
(
location
.
cursor
);
}
...
...
@@ -1282,7 +1295,7 @@ void KateMainWindow::goForward()
return
;
}
auto
location
=
m_locations
.
at
(
currentLocation
+
1
);
const
auto
&
location
=
m_locations
.
at
(
currentLocation
+
1
);
currentLocation
++
;
if
(
!
location
.
url
.
isValid
()
||
!
location
.
cursor
.
isValid
())
{
...
...
@@ -1297,7 +1310,14 @@ void KateMainWindow::goForward()
return
;
}
if
(
activeView
()
&&
activeView
()
->
document
()
&&
activeView
()
->
document
()
->
url
()
==
location
.
url
)
{
const
QSignalBlocker
blocker
(
activeView
());
activeView
()
->
setCursorPosition
(
location
.
cursor
);
return
;
}
auto
v
=
openUrl
(
location
.
url
);
const
QSignalBlocker
blocker
(
v
);
v
->
setCursorPosition
(
location
.
cursor
);
}
...
...
kate/katepluginmanager.cpp
View file @
a722a83a
...
...
@@ -238,15 +238,6 @@ void KatePluginManager::enablePluginGUI(KatePluginInfo *item, KateMainWindow *wi
if
(
createdView
->
metaObject
()
->
indexOfSignal
(
"message(QVariantMap)"
)
!=
-
1
)
{
connect
(
createdView
,
SIGNAL
(
message
(
const
QVariantMap
&
)),
win
->
outputView
(),
SLOT
(
slotMessage
(
const
QVariantMap
&
)),
Qt
::
UniqueConnection
);
}
// ensure jumping is connected for plugin view if available
if
(
createdView
->
metaObject
()
->
indexOfSignal
(
"jumped(QUrl,KTextEditor::Cursor)"
)
!=
-
1
)
{
connect
(
createdView
,
SIGNAL
(
jumped
(
const
QUrl
&
,
KTextEditor
::
Cursor
)),
win
,
SLOT
(
addJump
(
const
QUrl
&
,
KTextEditor
::
Cursor
)),
Qt
::
UniqueConnection
);
}
}
}
...
...
kate/kateviewmanager.cpp
View file @
a722a83a
...
...
@@ -452,6 +452,10 @@ KTextEditor::View *KateViewManager::createView(KTextEditor::Document *doc, KateV
// clang-format on
connect
(
view
,
&
KTextEditor
::
View
::
focusIn
,
this
,
&
KateViewManager
::
activateSpace
);
connect
(
view
,
&
KTextEditor
::
View
::
cursorPositionChanged
,
this
,
[
this
](
KTextEditor
::
View
*
view
,
const
KTextEditor
::
Cursor
&
newPosition
)
{
m_mainWindow
->
addJump
(
view
->
document
()
->
url
(),
newPosition
);
});
viewCreated
(
view
);
if
(
!
vs
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment