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
87a9e600
Commit
87a9e600
authored
Jan 11, 2021
by
Waqar Ahmed
Committed by
Christoph Cullmann
Jan 11, 2021
Browse files
Dont do multiple lookup for word with the same cursor
parent
ce14e874
Changes
1
Hide whitespace changes
Inline
Side-by-side
addons/lspclient/lspclientpluginview.cpp
View file @
87a9e600
...
...
@@ -597,11 +597,16 @@ public:
if
(
!
cur
.
isValid
())
return
false
;
auto
doc
=
v
->
document
();
if
(
!
doc
)
return
false
;
const
auto
word
=
doc
->
wordAt
(
cur
);
// The user pressed Ctrl + Click
if
(
event
->
type
()
==
QEvent
::
MouseButtonPress
)
{
if
(
mouseEvent
->
button
()
==
Qt
::
LeftButton
&&
mouseEvent
->
modifiers
()
==
Qt
::
ControlModifier
)
{
// must set cursor else we will be jumping somewhere else!!
const
auto
word
=
v
->
document
()
->
wordAt
(
cur
);
v
->
setCursorPosition
(
cur
);
if
(
!
word
.
isEmpty
())
{
m_ctrlHoverFeedback
.
clear
(
m_mainWindow
->
activeView
());
...
...
@@ -612,10 +617,8 @@ public:
// The user is hovering with Ctrl pressed
else
if
(
event
->
type
()
==
QEvent
::
MouseMove
)
{
if
(
mouseEvent
->
modifiers
()
==
Qt
::
ControlModifier
)
{
auto
doc
=
v
->
document
();
const
auto
hoveredWord
=
doc
->
wordAt
(
cur
);
const
auto
range
=
doc
->
wordRangeAt
(
cur
);
if
(
!
hoveredW
ord
.
isEmpty
()
&&
range
.
isValid
())
{
if
(
!
w
ord
.
isEmpty
()
&&
range
.
isValid
())
{
m_ctrlHoverFeedback
.
setRangeAndWidget
(
range
,
wid
);
// this will not go anywhere actually, but just signal whether we have a definition
// Also, please rethink very hard if you are going to reuse this method. It's made
...
...
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