summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@qt.io>2023-05-15 09:05:51 +0200
committerDavid Schulz <david.schulz@qt.io>2023-05-15 09:28:40 +0000
commitfe74e6d43bba607d0543164ff380fceaa54d0bb7 (patch)
tree1add9a04af28a63f536abfe18b1960dcd34ac876
parent63b2934a62c145d8916307a7833de2ef139901a0 (diff)
downloadqt-creator-fe74e6d43bba607d0543164ff380fceaa54d0bb7.tar.gz
FakeVim: only block suggestion when fakevim is in use
This fixes the issue that no copilot suggestion were shown after switching documents. Change-Id: Ic81bfbe266877964eeaf688d9915a7937607118b Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
-rw-r--r--src/plugins/fakevim/fakevimhandler.cpp5
-rw-r--r--src/plugins/fakevim/fakevimhandler.h2
-rw-r--r--src/plugins/fakevim/fakevimplugin.cpp2
3 files changed, 9 insertions, 0 deletions
diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp
index f41c8cc63a..2eb052432c 100644
--- a/src/plugins/fakevim/fakevimhandler.cpp
+++ b/src/plugins/fakevim/fakevimhandler.cpp
@@ -9546,6 +9546,11 @@ bool FakeVimHandler::jumpToLocalMark(QChar mark, bool backTickMode)
return d->jumpToMark(mark, backTickMode);
}
+bool FakeVimHandler::inFakeVimMode()
+{
+ return d->m_inFakeVim;
+}
+
} // namespace Internal
} // namespace FakeVim
diff --git a/src/plugins/fakevim/fakevimhandler.h b/src/plugins/fakevim/fakevimhandler.h
index 7c0cecaf73..0b615e1657 100644
--- a/src/plugins/fakevim/fakevimhandler.h
+++ b/src/plugins/fakevim/fakevimhandler.h
@@ -136,6 +136,8 @@ public:
bool jumpToLocalMark(QChar mark, bool backTickMode);
+ bool inFakeVimMode();
+
bool eventFilter(QObject *ob, QEvent *ev) override;
Callback<void(const QString &msg, int cursorPos, int anchorPos, int messageLevel)>
diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp
index 2f86a7d87a..be06ece7f4 100644
--- a/src/plugins/fakevim/fakevimplugin.cpp
+++ b/src/plugins/fakevim/fakevimplugin.cpp
@@ -1587,6 +1587,8 @@ void FakeVimPluginPrivate::editorOpened(IEditor *editor)
handler->modeChanged.set([tew, this, editor](bool insertMode) {
HandlerAndData &handlerAndData = m_editorToHandler[editor];
+ if (!handlerAndData.handler->inFakeVimMode())
+ return;
// We don't want to show suggestions unless we are in insert mode.
if (insertMode != (handlerAndData.suggestionBlocker == nullptr))