7#ifndef KATEVI_EMULATED_COMMAND_BAR_COMPLETER_H
8#define KATEVI_EMULATED_COMMAND_BAR_COMPLETER_H
27class EmulatedCommandBar;
29struct CompletionStartParams {
30 static CompletionStartParams createModeSpecific(
const QStringList &completions,
34 CompletionStartParams completionStartParams;
35 completionStartParams.completionType = ModeSpecific;
36 completionStartParams.completions = completions;
37 completionStartParams.wordStartPos = wordStartPos;
38 completionStartParams.completionTransform = completionTransform;
39 return completionStartParams;
41 static CompletionStartParams invalid()
43 CompletionStartParams completionStartParams;
44 completionStartParams.completionType = None;
45 return completionStartParams;
47 enum CompletionType { None, ModeSpecific, WordFromDocument };
48 CompletionType completionType = None;
49 int wordStartPos = -1;
57 enum class CompletionInvocation { ExtraContext, NormalContext };
58 Completer(EmulatedCommandBar *emulatedCommandBar, KTextEditor::ViewPrivate *view,
QLineEdit *edit);
59 void startCompletion(
const CompletionStartParams &completionStartParams);
60 void deactivateCompletion();
61 bool isCompletionActive()
const;
62 bool isNextTextChangeDueToCompletionChange()
const;
63 bool completerHandledKeypress(
const QKeyEvent *keyEvent);
64 void editTextChanged(
const QString &newText);
65 void setCurrentMode(ActiveMode *currentMode);
69 KTextEditor::ViewPrivate *m_view;
70 ActiveMode *m_currentMode =
nullptr;
72 void setCompletionIndex(
int index);
73 void currentCompletionChanged();
74 void updateCompletionPrefix();
75 CompletionStartParams activateWordFromDocumentCompletion();
77 int wordBeforeCursorBegin();
78 void abortCompletionAndResetToPreCompletion();
82 QString m_textToRevertToIfCompletionAborted;
83 int m_cursorPosToRevertToIfCompletionAborted = 0;
84 bool m_isNextTextChangeDueToCompletionChange =
false;
85 CompletionStartParams m_currentCompletionStartParams;
86 CompletionStartParams::CompletionType m_currentCompletionType = CompletionStartParams::None;
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...