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>
This commit is contained in:
David Schulz
2023-05-15 09:05:51 +02:00
parent 63b2934a62
commit fe74e6d43b
3 changed files with 9 additions and 0 deletions

View File

@@ -9546,6 +9546,11 @@ bool FakeVimHandler::jumpToLocalMark(QChar mark, bool backTickMode)
return d->jumpToMark(mark, backTickMode); return d->jumpToMark(mark, backTickMode);
} }
bool FakeVimHandler::inFakeVimMode()
{
return d->m_inFakeVim;
}
} // namespace Internal } // namespace Internal
} // namespace FakeVim } // namespace FakeVim

View File

@@ -136,6 +136,8 @@ public:
bool jumpToLocalMark(QChar mark, bool backTickMode); bool jumpToLocalMark(QChar mark, bool backTickMode);
bool inFakeVimMode();
bool eventFilter(QObject *ob, QEvent *ev) override; bool eventFilter(QObject *ob, QEvent *ev) override;
Callback<void(const QString &msg, int cursorPos, int anchorPos, int messageLevel)> Callback<void(const QString &msg, int cursorPos, int anchorPos, int messageLevel)>

View File

@@ -1587,6 +1587,8 @@ void FakeVimPluginPrivate::editorOpened(IEditor *editor)
handler->modeChanged.set([tew, this, editor](bool insertMode) { handler->modeChanged.set([tew, this, editor](bool insertMode) {
HandlerAndData &handlerAndData = m_editorToHandler[editor]; HandlerAndData &handlerAndData = m_editorToHandler[editor];
if (!handlerAndData.handler->inFakeVimMode())
return;
// We don't want to show suggestions unless we are in insert mode. // We don't want to show suggestions unless we are in insert mode.
if (insertMode != (handlerAndData.suggestionBlocker == nullptr)) if (insertMode != (handlerAndData.suggestionBlocker == nullptr))