summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2023-05-16 11:09:50 +0200
committerhjk <hjk@qt.io>2023-05-17 13:24:41 +0000
commit5ad790d5c8f70b46c8603724e919fc3e30d10c60 (patch)
treed17bac104ff40da0aabd1fea94d0d26c7a7aa99e /src
parentb2e30e7ef86595c537062cb8261a0735b389949c (diff)
downloadqt-creator-5ad790d5c8f70b46c8603724e919fc3e30d10c60.tar.gz
FakeVim: Maintain highlighting on split
Fixes: QTCREATORBUG-28914 Change-Id: I4e0b82e49bd97f19eb513f21e1dc405ea9f0700c Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/fakevim/fakevimplugin.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp
index be06ece7f4..4935492132 100644
--- a/src/plugins/fakevim/fakevimplugin.cpp
+++ b/src/plugins/fakevim/fakevimplugin.cpp
@@ -514,6 +514,8 @@ public:
void handleDelayedQuit(bool forced, Core::IEditor *editor);
void userActionTriggered(int key);
+ void updateAllHightLights();
+
void switchToFile(int n);
int currentFile() const;
@@ -557,6 +559,8 @@ public:
MiniBuffer *m_miniBuffer = nullptr;
FakeVimPluginRunData *runData = nullptr;
+ QString m_lastHighlight;
+
int m_savedCursorFlashTime = 0;
};
@@ -1252,6 +1256,16 @@ void FakeVimPluginPrivate::userActionTriggered(int key)
}
}
+void FakeVimPluginPrivate::updateAllHightLights()
+{
+ const QList<IEditor *> editors = EditorManager::visibleEditors();
+ for (IEditor *editor : editors) {
+ QWidget *w = editor->widget();
+ if (auto find = Aggregation::query<IFindSupport>(w))
+ find->highlightAll(m_lastHighlight, FindRegularExpression | FindCaseSensitively);
+ }
+}
+
void FakeVimPluginPrivate::createRelativeNumberWidget(IEditor *editor)
{
if (auto textEditor = TextEditorWidget::fromEditor(editor)) {
@@ -1598,7 +1612,8 @@ void FakeVimPluginPrivate::editorOpened(IEditor *editor)
tew->clearSuggestion();
});
- handler->highlightMatches.set([](const QString &needle) {
+ handler->highlightMatches.set([this](const QString &needle) {
+ m_lastHighlight = needle;
for (IEditor *editor : EditorManager::visibleEditors()) {
QWidget *w = editor->widget();
if (auto find = Aggregation::query<IFindSupport>(w))
@@ -2034,9 +2049,11 @@ void FakeVimPluginPrivate::handleExCommand(FakeVimHandler *handler, bool *handle
} else if (cmd.matches("sp", "split")) {
// :sp[lit]
triggerAction(Core::Constants::SPLIT);
+ updateAllHightLights();
} else if (cmd.matches("vs", "vsplit")) {
// :vs[plit]
triggerAction(Core::Constants::SPLIT_SIDE_BY_SIDE);
+ updateAllHightLights();
} else if (cmd.matches("mak", "make")) {
// :mak[e][!] [arguments]
triggerAction(ProjectExplorer::Constants::BUILD);