forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -514,6 +514,8 @@ public:
|
|||||||
void handleDelayedQuit(bool forced, Core::IEditor *editor);
|
void handleDelayedQuit(bool forced, Core::IEditor *editor);
|
||||||
void userActionTriggered(int key);
|
void userActionTriggered(int key);
|
||||||
|
|
||||||
|
void updateAllHightLights();
|
||||||
|
|
||||||
void switchToFile(int n);
|
void switchToFile(int n);
|
||||||
int currentFile() const;
|
int currentFile() const;
|
||||||
|
|
||||||
@@ -557,6 +559,8 @@ public:
|
|||||||
MiniBuffer *m_miniBuffer = nullptr;
|
MiniBuffer *m_miniBuffer = nullptr;
|
||||||
FakeVimPluginRunData *runData = nullptr;
|
FakeVimPluginRunData *runData = nullptr;
|
||||||
|
|
||||||
|
QString m_lastHighlight;
|
||||||
|
|
||||||
int m_savedCursorFlashTime = 0;
|
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)
|
void FakeVimPluginPrivate::createRelativeNumberWidget(IEditor *editor)
|
||||||
{
|
{
|
||||||
if (auto textEditor = TextEditorWidget::fromEditor(editor)) {
|
if (auto textEditor = TextEditorWidget::fromEditor(editor)) {
|
||||||
@@ -1598,7 +1612,8 @@ void FakeVimPluginPrivate::editorOpened(IEditor *editor)
|
|||||||
tew->clearSuggestion();
|
tew->clearSuggestion();
|
||||||
});
|
});
|
||||||
|
|
||||||
handler->highlightMatches.set([](const QString &needle) {
|
handler->highlightMatches.set([this](const QString &needle) {
|
||||||
|
m_lastHighlight = needle;
|
||||||
for (IEditor *editor : EditorManager::visibleEditors()) {
|
for (IEditor *editor : EditorManager::visibleEditors()) {
|
||||||
QWidget *w = editor->widget();
|
QWidget *w = editor->widget();
|
||||||
if (auto find = Aggregation::query<IFindSupport>(w))
|
if (auto find = Aggregation::query<IFindSupport>(w))
|
||||||
@@ -2034,9 +2049,11 @@ void FakeVimPluginPrivate::handleExCommand(FakeVimHandler *handler, bool *handle
|
|||||||
} else if (cmd.matches("sp", "split")) {
|
} else if (cmd.matches("sp", "split")) {
|
||||||
// :sp[lit]
|
// :sp[lit]
|
||||||
triggerAction(Core::Constants::SPLIT);
|
triggerAction(Core::Constants::SPLIT);
|
||||||
|
updateAllHightLights();
|
||||||
} else if (cmd.matches("vs", "vsplit")) {
|
} else if (cmd.matches("vs", "vsplit")) {
|
||||||
// :vs[plit]
|
// :vs[plit]
|
||||||
triggerAction(Core::Constants::SPLIT_SIDE_BY_SIDE);
|
triggerAction(Core::Constants::SPLIT_SIDE_BY_SIDE);
|
||||||
|
updateAllHightLights();
|
||||||
} else if (cmd.matches("mak", "make")) {
|
} else if (cmd.matches("mak", "make")) {
|
||||||
// :mak[e][!] [arguments]
|
// :mak[e][!] [arguments]
|
||||||
triggerAction(ProjectExplorer::Constants::BUILD);
|
triggerAction(ProjectExplorer::Constants::BUILD);
|
||||||
|
Reference in New Issue
Block a user