9#ifndef KATEVI_INPUT_MODE_MANAGER_H
10#define KATEVI_INPUT_MODE_MANAGER_H
14#include <ktexteditor/cursor.h>
15#include <ktexteditor/view.h>
16#include <ktexteditor_export.h>
18#include <vimode/completion.h>
19#include <vimode/definitions.h>
22class KateViewInternal;
39class CompletionRecorder;
40class CompletionReplayer;
44class LastChangeRecorder;
55 friend KateViInputMode;
58 InputModeManager(KateViInputMode *inputAdapter, KTextEditor::ViewPrivate *view, KateViewInternal *viewInternal);
60 InputModeManager(
const InputModeManager &) =
delete;
61 InputModeManager &operator=(
const InputModeManager &) =
delete;
67 bool handleKeypress(
const QKeyEvent *e);
72 void feedKeyPresses(
const QString &keyPresses)
const;
78 bool isHandlingKeypress()
const;
83 KTEXTEDITOR_EXPORT ViMode getCurrentViMode()
const;
93 ViMode getPreviousViMode()
const;
98 bool isAnyVisualMode()
const;
103 ModeBase *getCurrentViModeHandler()
const;
105 const QString getVerbatimKeys()
const;
110 void changeViMode(ViMode newMode);
115 KTEXTEDITOR_EXPORT
void viEnterNormalMode();
120 void viEnterInsertMode();
125 void viEnterVisualMode(ViMode visualMode = ViMode::VisualMode);
130 void viEnterReplaceMode();
135 NormalViMode *getViNormalMode();
140 InsertViMode *getViInsertMode();
145 VisualViMode *getViVisualMode();
150 ReplaceViMode *getViReplaceMode();
155 void clearCurrentChangeLog();
160 void storeLastChangeCommand();
165 void repeatLastChange();
167 void doNotLogCurrentKeypress();
169 bool getTemporaryNormalMode()
171 return m_temporaryNormalMode;
174 void setTemporaryNormalMode(
bool b)
176 m_temporaryNormalMode = b;
181 inline Marks *marks()
185 inline Jumps *jumps()
190 inline Searcher *searcher()
195 CompletionRecorder *completionRecorder()
197 return m_completionRecorder;
199 CompletionReplayer *completionReplayer()
201 return m_completionReplayer;
204 MacroRecorder *macroRecorder()
206 return m_macroRecorder;
209 LastChangeRecorder *lastChangeRecorder()
211 return m_lastChangeRecorder;
215 void readSessionConfig(
const KConfigGroup &config);
216 void writeSessionConfig(KConfigGroup &config);
218 KTEXTEDITOR_EXPORT KeyMapper *keyMapper();
219 GlobalState *globalState()
const;
220 KTextEditor::ViewPrivate *view()
const;
222 KateViInputMode *inputAdapter()
224 return m_inputAdapter;
227 void updateCursor(
const KTextEditor::Cursor c);
229 void pushKeyMapper(std::shared_ptr<KeyMapper> mapper);
233 NormalViMode *m_viNormalMode;
234 InsertViMode *m_viInsertMode;
235 VisualViMode *m_viVisualMode;
236 ReplaceViMode *m_viReplaceMode;
238 ViMode m_currentViMode;
239 ViMode m_previousViMode;
241 KateViInputMode *m_inputAdapter;
242 KTextEditor::ViewPrivate *m_view;
243 KateViewInternal *m_viewInternal;
244 KeyParser *m_keyParser;
248 QStack<std::shared_ptr<KeyMapper>> m_keyMapperStack;
250 int m_insideHandlingKeyPressCount;
255 QString m_lastChange;
257 CompletionList m_lastChangeCompletionsLog;
262 bool m_temporaryNormalMode;
267 Searcher *m_searcher;
268 CompletionRecorder *m_completionRecorder;
269 CompletionReplayer *m_completionReplayer;
271 MacroRecorder *m_macroRecorder;
273 LastChangeRecorder *m_lastChangeRecorder;
Backend of KTextEditor::Document related public KTextEditor interfaces.
A Cursor which is bound to a specific Document, and maintains its position.
ViewMode
Possible view modes These correspond to various modes the text editor might be in.
for encoding keypresses w/ modifiers into an internal QChar representation and back again to a descri...
Commands for the vi normal mode.
Commands for the vi replace mode.
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...