File indexing completed on 2024-04-28 15:31:18

0001 /*
0002     SPDX-FileCopyrightText: KDE Developers
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KATEVI_COMPLETIONREPLAYER_H
0008 #define KATEVI_COMPLETIONREPLAYER_H
0009 
0010 #include "completion.h"
0011 
0012 #include <QStack>
0013 
0014 namespace KTextEditor
0015 {
0016 class Cursor;
0017 }
0018 
0019 namespace KateVi
0020 {
0021 class InputModeManager;
0022 
0023 class CompletionReplayer
0024 {
0025 public:
0026     explicit CompletionReplayer(InputModeManager *viInputModeManager);
0027     ~CompletionReplayer();
0028 
0029     void start(const CompletionList &completions);
0030     void stop();
0031 
0032     void replay();
0033 
0034 private:
0035     Completion nextCompletion();
0036     int findNextMergeableBracketPos(const KTextEditor::Cursor startPos) const;
0037 
0038 private:
0039     InputModeManager *m_viInputModeManager;
0040 
0041     QStack<CompletionList> m_CompletionsToReplay;
0042     QStack<int> m_nextCompletionIndex;
0043 };
0044 
0045 }
0046 
0047 #endif // KATEVI_COMPLETIONREPLAYER_H