Warning, file /frameworks/ktexteditor/src/vimode/emulatedcommandbar/searchmode.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     SPDX-FileCopyrightText: 2013-2016 Simon St James <kdedevel@etotheipiplusone.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KATEVI_EMULATED_COMMAND_BAR_SEARCHMODE_H
0008 #define KATEVI_EMULATED_COMMAND_BAR_SEARCHMODE_H
0009 
0010 #include "../searcher.h"
0011 #include "activemode.h"
0012 
0013 namespace KTextEditor
0014 {
0015 class ViewPrivate;
0016 }
0017 
0018 #include <KTextEditor/Cursor>
0019 
0020 namespace KateVi
0021 {
0022 class EmulatedCommandBar;
0023 QString vimRegexToQtRegexPattern(const QString &vimRegexPattern); // TODO - move these generic helper functions into their own file?
0024 QString withCaseSensitivityMarkersStripped(const QString &originalSearchTerm);
0025 QString ensuredCharEscaped(const QString &originalString, QChar charToEscape);
0026 QStringList reversed(const QStringList &originalList);
0027 
0028 class SearchMode : public ActiveMode
0029 {
0030 public:
0031     SearchMode(EmulatedCommandBar *emulatedCommandBar,
0032                MatchHighlighter *matchHighlighter,
0033                InputModeManager *viInputModeManager,
0034                KTextEditor::ViewPrivate *view,
0035                QLineEdit *edit);
0036     ~SearchMode() override
0037     {
0038     }
0039     enum class SearchDirection { Forward, Backward };
0040     void init(SearchDirection);
0041     bool handleKeyPress(const QKeyEvent *keyEvent) override;
0042     void editTextChanged(const QString &newText) override;
0043     CompletionStartParams completionInvoked(Completer::CompletionInvocation invocationType) override;
0044     void completionChosen() override;
0045     void deactivate(bool wasAborted) override;
0046     bool isSendingSyntheticSearchCompletedKeypress() const
0047     {
0048         return m_isSendingSyntheticSearchCompletedKeypress;
0049     }
0050 
0051 private:
0052     QLineEdit *m_edit = nullptr;
0053     SearchDirection m_searchDirection;
0054     KTextEditor::Cursor m_startingCursorPos;
0055     KateVi::Searcher::SearchParams m_currentSearchParams;
0056     CompletionStartParams activateSearchHistoryCompletion();
0057     enum BarBackgroundStatus { Normal, MatchFound, NoMatchFound };
0058     void setBarBackground(BarBackgroundStatus status);
0059     bool m_isSendingSyntheticSearchCompletedKeypress = false;
0060 };
0061 }
0062 
0063 #endif