KTextEditor

searchmode.h
1/*
2 SPDX-FileCopyrightText: 2013-2016 Simon St James <kdedevel@etotheipiplusone.com>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KATEVI_EMULATED_COMMAND_BAR_SEARCHMODE_H
8#define KATEVI_EMULATED_COMMAND_BAR_SEARCHMODE_H
9
10#include "../searcher.h"
11#include "activemode.h"
12
13namespace KTextEditor
14{
15class ViewPrivate;
16}
17
18#include <KTextEditor/Cursor>
19
20namespace KateVi
21{
22class EmulatedCommandBar;
23QString vimRegexToQtRegexPattern(const QString &vimRegexPattern); // TODO - move these generic helper functions into their own file?
24QString withCaseSensitivityMarkersStripped(const QString &originalSearchTerm);
25QString ensuredCharEscaped(const QString &originalString, QChar charToEscape);
26QStringList reversed(const QStringList &originalList);
27
28class SearchMode : public ActiveMode
29{
30public:
31 SearchMode(EmulatedCommandBar *emulatedCommandBar,
32 MatchHighlighter *matchHighlighter,
33 InputModeManager *viInputModeManager,
34 KTextEditor::ViewPrivate *view,
35 QLineEdit *edit);
36 ~SearchMode() override
37 {
38 }
39 enum class SearchDirection { Forward, Backward };
40 void init(SearchDirection);
41 bool handleKeyPress(const QKeyEvent *keyEvent) override;
42 void editTextChanged(const QString &newText) override;
43 CompletionStartParams completionInvoked(Completer::CompletionInvocation invocationType) override;
44 void completionChosen() override;
45 void deactivate(bool wasAborted) override;
46 bool isSendingSyntheticSearchCompletedKeypress() const
47 {
48 return m_isSendingSyntheticSearchCompletedKeypress;
49 }
50
51private:
52 QLineEdit *m_edit = nullptr;
53 SearchDirection m_searchDirection;
54 KTextEditor::Cursor m_startingCursorPos;
55 KateVi::Searcher::SearchParams m_currentSearchParams;
56 CompletionStartParams activateSearchHistoryCompletion();
57 enum BarBackgroundStatus { Normal, MatchFound, NoMatchFound };
58 void setBarBackground(BarBackgroundStatus status);
59 bool m_isSendingSyntheticSearchCompletedKeypress = false;
60};
61}
62
63#endif
The Cursor represents a position in a Document.
Definition cursor.h:75
Q_SCRIPTABLE CaptureState status()
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...
Extended searcher for Emulated Command Bar.
Definition searcher.h:43
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 14 2024 11:57:26 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.