| 1 | /* |
| 2 | SPDX-FileCopyrightText: KDE Developers |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.0-or-later |
| 5 | */ |
| 6 | |
| 7 | #ifndef KATEVI_COMPLETIONREPLAYER_H |
| 8 | #define KATEVI_COMPLETIONREPLAYER_H |
| 9 | |
| 10 | #include "completion.h" |
| 11 | |
| 12 | #include <QStack> |
| 13 | |
| 14 | namespace KTextEditor |
| 15 | { |
| 16 | class Cursor; |
| 17 | } |
| 18 | |
| 19 | namespace KateVi |
| 20 | { |
| 21 | class InputModeManager; |
| 22 | |
| 23 | class CompletionReplayer |
| 24 | { |
| 25 | public: |
| 26 | explicit CompletionReplayer(InputModeManager *viInputModeManager); |
| 27 | ~CompletionReplayer(); |
| 28 | |
| 29 | void start(const CompletionList &completions); |
| 30 | void stop(); |
| 31 | |
| 32 | void replay(); |
| 33 | |
| 34 | private: |
| 35 | Completion nextCompletion(); |
| 36 | int findNextMergeableBracketPos(const KTextEditor::Cursor startPos) const; |
| 37 | |
| 38 | private: |
| 39 | InputModeManager *m_viInputModeManager; |
| 40 | |
| 41 | QStack<CompletionList> m_CompletionsToReplay; |
| 42 | QStack<int> m_nextCompletionIndex; |
| 43 | }; |
| 44 | |
| 45 | } |
| 46 | |
| 47 | #endif // KATEVI_COMPLETIONREPLAYER_H |
| 48 | |