From fe74e6d43bba607d0543164ff380fceaa54d0bb7 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Mon, 15 May 2023 09:05:51 +0200 Subject: [PATCH] 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 --- src/plugins/fakevim/fakevimhandler.cpp | 5 +++++ src/plugins/fakevim/fakevimhandler.h | 2 ++ src/plugins/fakevim/fakevimplugin.cpp | 2 ++ 3 files changed, 9 insertions(+) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index f41c8cc63a6..2eb052432cf 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 7c0cecaf738..0b615e1657e 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 diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index 2f86a7d87a7..be06ece7f45 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))