20 #ifndef KATEVIEMULATEDCOMMANDBAR_H
21 #define KATEVIEMULATEDCOMMANDBAR_H
25 #include <ktexteditor/cursor.h>
26 #include <ktexteditor/attribute.h>
27 #include <ktexteditor/movingrange.h>
49 void setCommandResponseMessageTimeout(
long commandResponseMessageTimeOutMS);
51 bool handleKeyPress(
const QKeyEvent* keyEvent);
52 bool isSendingSyntheticSearchCompletedKeypress();
61 QLabel *m_barTypeIndicator;
62 void showBarTypeIndicator(Mode mode);
63 KTextEditor::Cursor m_startingCursorPos;
65 bool m_suspendEditEventFiltering;
66 bool m_waitingForRegister;
67 QLabel *m_waitingForRegisterIndicator;
68 bool m_insertedTextShouldBeEscapedForSearchingAsLiteral;
70 QTimer *m_commandResponseMessageDisplayHide;
71 QLabel* m_commandResponseMessageDisplay;
72 long m_commandResponseMessageTimeOutMS;
74 void switchToCommandResponseDisplay(
const QString& commandResponseMessage);
76 QLabel *m_interactiveSedReplaceLabel;
77 bool m_interactiveSedReplaceActive;
78 void updateInteractiveSedReplaceLabelText();
80 void finishInteractiveSedReplace();
82 void moveCursorTo(
const KTextEditor::Cursor& cursorPos);
86 bool m_isNextTextChangeDueToCompletionChange;
87 enum CompletionType {
None, SearchHistory, WordFromDocument, Commands, CommandHistory, SedFindHistory, SedReplaceHistory };
88 CompletionType m_currentCompletionType;
89 void updateCompletionPrefix();
90 void currentCompletionChanged();
91 bool m_completionActive;
92 QString m_textToRevertToIfCompletionAborted;
93 int m_cursorPosToRevertToIfCompletionAborted;
95 KTextEditor::Attribute::Ptr m_highlightMatchAttribute;
96 KTextEditor::MovingRange* m_highlightedMatch;
97 void updateMatchHighlight(
const KTextEditor::Range& matchRange);
98 enum BarBackgroundStatus { Normal, MatchFound, NoMatchFound };
99 void setBarBackground(BarBackgroundStatus status);
101 QString m_currentSearchPattern;
102 bool m_currentSearchIsCaseSensitive;
103 bool m_currentSearchIsBackwards;
104 bool m_currentSearchPlacesCursorAtEndOfMatch;
106 bool m_isSendingSyntheticSearchCompletedKeypress;
109 void deleteSpacesToLeftOfCursor();
110 void deleteWordCharsToLeftOfCursor();
111 bool deleteNonWordCharsToLeftOfCursor();
114 void replaceWordBeforeCursorWith(
const QString& newWord);
115 void replaceCommandBeforeCursorWith(
const QString& newCommand);
117 void activateSearchHistoryCompletion();
118 void activateWordFromDocumentCompletion();
119 void activateCommandCompletion();
120 void activateCommandHistoryCompletion();
121 void activateSedFindHistoryCompletion();
122 void activateSedReplaceHistoryCompletion();
123 void deactivateCompletion();
124 void abortCompletionAndResetToPreCompletion();
125 void setCompletionIndex(
int index);
132 struct ParsedSedExpression
134 bool parsedSuccessfully;
141 ParsedSedExpression parseAsSedExpression();
143 QString withSedReplaceTermReplacedWith(
const QString& newReplaceTerm);
148 bool isCursorInFindTermOfSed();
149 bool isCursorInReplaceTermOfSed();
155 QString withoutRangeExpression();
158 void editTextChanged(
const QString& newText);
159 void updateMatchHighlightAttrib();
160 void startHideCommandResponseTimer();
#define KATEPART_TESTS_EXPORT
virtual bool eventFilter(QObject *watched, QEvent *event)
A KateViewBarWidget that attempts to emulate some of the features of Vim's own command bar...