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;
52 CompletionType completionType = None;
53 int wordStartPos = -1;
61 enum class CompletionInvocation {
65 Completer(EmulatedCommandBar *emulatedCommandBar, KTextEditor::ViewPrivate *view,
QLineEdit *edit);
66 void startCompletion(
const CompletionStartParams &completionStartParams);
67 void deactivateCompletion();
68 bool isCompletionActive()
const;
69 bool isNextTextChangeDueToCompletionChange()
const;
70 bool completerHandledKeypress(
const QKeyEvent *keyEvent);
71 void editTextChanged(
const QString &newText);
72 void setCurrentMode(ActiveMode *currentMode);
76 KTextEditor::ViewPrivate *m_view;
77 ActiveMode *m_currentMode =
nullptr;
79 void setCompletionIndex(
int index);
80 void currentCompletionChanged();
81 void updateCompletionPrefix();
82 CompletionStartParams activateWordFromDocumentCompletion();
84 int wordBeforeCursorBegin();
85 void abortCompletionAndResetToPreCompletion();
89 QString m_textToRevertToIfCompletionAborted;
90 int m_cursorPosToRevertToIfCompletionAborted = 0;
91 bool m_isNextTextChangeDueToCompletionChange =
false;
92 CompletionStartParams m_currentCompletionStartParams;
93 CompletionStartParams::CompletionType m_currentCompletionType = CompletionStartParams::None;
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...