forked from qt-creator/qt-creator
FakeVim: Clear suggestions on mode change
Change-Id: I5d3a37ab61f83a70e055063de397654f5621401d Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -5197,6 +5197,7 @@ void FakeVimHandler::Private::handleReplaceMode(const Input &input)
|
|||||||
moveDown();
|
moveDown();
|
||||||
} else if (input.isKey(Key_Insert)) {
|
} else if (input.isKey(Key_Insert)) {
|
||||||
g.mode = InsertMode;
|
g.mode = InsertMode;
|
||||||
|
q->modeChanged();
|
||||||
} else if (input.isControl('o')) {
|
} else if (input.isControl('o')) {
|
||||||
enterCommandMode(ReplaceMode);
|
enterCommandMode(ReplaceMode);
|
||||||
} else {
|
} else {
|
||||||
@@ -5394,6 +5395,7 @@ void FakeVimHandler::Private::handleInsertMode(const Input &input)
|
|||||||
removeText(range);
|
removeText(range);
|
||||||
} else if (input.isKey(Key_Insert)) {
|
} else if (input.isKey(Key_Insert)) {
|
||||||
g.mode = ReplaceMode;
|
g.mode = ReplaceMode;
|
||||||
|
q->modeChanged();
|
||||||
} else if (input.isKey(Key_Left)) {
|
} else if (input.isKey(Key_Left)) {
|
||||||
moveLeft();
|
moveLeft();
|
||||||
} else if (input.isShift(Key_Left) || input.isControl(Key_Left)) {
|
} else if (input.isShift(Key_Left) || input.isControl(Key_Left)) {
|
||||||
@@ -8575,6 +8577,8 @@ void FakeVimHandler::Private::enterInsertOrReplaceMode(Mode mode)
|
|||||||
g.returnToMode = mode;
|
g.returnToMode = mode;
|
||||||
clearLastInsertion();
|
clearLastInsertion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
q->modeChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FakeVimHandler::Private::enterVisualInsertMode(QChar command)
|
void FakeVimHandler::Private::enterVisualInsertMode(QChar command)
|
||||||
@@ -8650,6 +8654,8 @@ void FakeVimHandler::Private::enterCommandMode(Mode returnToMode)
|
|||||||
g.returnToMode = returnToMode;
|
g.returnToMode = returnToMode;
|
||||||
m_positionPastEnd = false;
|
m_positionPastEnd = false;
|
||||||
m_anchorPastEnd = false;
|
m_anchorPastEnd = false;
|
||||||
|
|
||||||
|
q->modeChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FakeVimHandler::Private::enterExMode(const QString &contents)
|
void FakeVimHandler::Private::enterExMode(const QString &contents)
|
||||||
@@ -8664,6 +8670,8 @@ void FakeVimHandler::Private::enterExMode(const QString &contents)
|
|||||||
g.submode = NoSubMode;
|
g.submode = NoSubMode;
|
||||||
g.subsubmode = NoSubSubMode;
|
g.subsubmode = NoSubSubMode;
|
||||||
unfocus();
|
unfocus();
|
||||||
|
|
||||||
|
q->modeChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FakeVimHandler::Private::recordJump(int position)
|
void FakeVimHandler::Private::recordJump(int position)
|
||||||
|
@@ -157,6 +157,7 @@ public:
|
|||||||
Signal<void()> completionRequested;
|
Signal<void()> completionRequested;
|
||||||
Signal<void()> tabPreviousRequested;
|
Signal<void()> tabPreviousRequested;
|
||||||
Signal<void()> tabNextRequested;
|
Signal<void()> tabNextRequested;
|
||||||
|
Signal<void()> modeChanged;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class Private;
|
class Private;
|
||||||
|
@@ -1591,6 +1591,11 @@ void FakeVimPluginPrivate::editorOpened(IEditor *editor)
|
|||||||
tew->setExtraSelections(TextEditorWidget::FakeVimSelection, selection);
|
tew->setExtraSelections(TextEditorWidget::FakeVimSelection, selection);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
handler->modeChanged.connect([tew]() {
|
||||||
|
if (tew)
|
||||||
|
tew->clearSuggestion();
|
||||||
|
});
|
||||||
|
|
||||||
handler->highlightMatches.connect([](const QString &needle) {
|
handler->highlightMatches.connect([](const QString &needle) {
|
||||||
for (IEditor *editor : EditorManager::visibleEditors()) {
|
for (IEditor *editor : EditorManager::visibleEditors()) {
|
||||||
QWidget *w = editor->widget();
|
QWidget *w = editor->widget();
|
||||||
|
Reference in New Issue
Block a user