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 {
40 Forward,
41 Backward
42 };
43 void init(SearchDirection);
44 bool handleKeyPress(const QKeyEvent *keyEvent) override;
45 void editTextChanged(const QString &newText) override;
46 CompletionStartParams completionInvoked(Completer::CompletionInvocation invocationType) override;
47 void completionChosen() override;
48 void deactivate(bool wasAborted) override;
49 bool isSendingSyntheticSearchCompletedKeypress() const
50 {
51 return m_isSendingSyntheticSearchCompletedKeypress;
52 }
53
54private:
55 QLineEdit *m_edit = nullptr;
56 SearchDirection m_searchDirection;
57 KTextEditor::Cursor m_startingCursorPos;
58 KateVi::Searcher::SearchParams m_currentSearchParams;
59 CompletionStartParams activateSearchHistoryCompletion();
60 enum BarBackgroundStatus {
61 Normal,
62 MatchFound,
63 NoMatchFound
64 };
65 void setBarBackground(BarBackgroundStatus status);
66 bool m_isSendingSyntheticSearchCompletedKeypress = false;
67};
68}
69
70#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 Sat Dec 21 2024 17:01:56 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.