10#ifndef KATEVI_MODE_BASE_H
11#define KATEVI_MODE_BASE_H
13#include <ktexteditor/range.h>
16#include <vimode/definitions.h>
17#include <vimode/range.h>
22class KateViewInternal;
32class InputModeManager;
43class ModeBase :
public QObject
47 ~ModeBase()
override =
default;
52 QString getVerbatimKeys()
const;
53 virtual bool handleKeypress(
const QKeyEvent *e) = 0;
55 void setCount(
unsigned int count)
59 void setRegister(QChar reg)
64 void error(
const QString &errorMsg);
65 void message(
const QString &msg);
67 Range motionFindNext();
68 Range motionFindPrev();
70 virtual void goToPos(
const Range &r);
75 void yankToClipBoard(QChar chosen_register,
const QString &text);
76 bool deleteRange(Range &r, OperationMode mode = LineWise,
bool addToRegister =
true);
77 const QString getRange(Range &r, OperationMode mode = LineWise)
const;
78 const QString getLine(
int line = -1)
const;
79 const QChar getCharUnderCursor()
const;
80 const QString getWordUnderCursor()
const;
81 const KTextEditor::Range getWordRangeUnderCursor()
const;
82 KTextEditor::Cursor findNextWordStart(
int fromLine,
int fromColumn,
bool onlyCurrentLine =
false)
const;
83 KTextEditor::Cursor findNextWORDStart(
int fromLine,
int fromColumn,
bool onlyCurrentLine =
false)
const;
84 KTextEditor::Cursor findPrevWordStart(
int fromLine,
int fromColumn,
bool onlyCurrentLine =
false)
const;
85 KTextEditor::Cursor findPrevWORDStart(
int fromLine,
int fromColumn,
bool onlyCurrentLine =
false)
const;
86 KTextEditor::Cursor findPrevWordEnd(
int fromLine,
int fromColumn,
bool onlyCurrentLine =
false)
const;
87 KTextEditor::Cursor findPrevWORDEnd(
int fromLine,
int fromColumn,
bool onlyCurrentLine =
false)
const;
88 KTextEditor::Cursor findWordEnd(
int fromLine,
int fromColumn,
bool onlyCurrentLine =
false)
const;
89 KTextEditor::Cursor findWORDEnd(
int fromLine,
int fromColumn,
bool onlyCurrentLine =
false)
const;
91 Range findSurroundingBrackets(
const QChar &c1,
const QChar &c2,
bool inner,
const QChar &nested1,
const QChar &nested2)
const;
93 Range findSurrounding(
const QRegularExpression &c1,
const QRegularExpression &c2,
bool inner =
false)
const;
94 Range findSurroundingQuotes(
const QChar &c,
bool inner =
false)
const;
96 int findLineStartingWitchChar(
const QChar &c,
int count,
bool forward =
true)
const;
97 void updateCursor(
const KTextEditor::Cursor c)
const;
98 static const QChar getCharAtVirtualColumn(
const QString &line,
int virtualColumn,
int tabWidht);
100 void addToNumberUnderCursor(
int count);
104 Range goLineUpDown(
int lines);
105 Range goVisualLineUpDown(
int lines);
107 unsigned int linesDisplayed()
const;
108 void scrollViewLines(
int l);
110 bool isCounted()
const
115 bool startNormalMode();
116 bool startInsertMode();
117 bool startVisualMode();
118 bool startVisualLineMode();
119 bool startVisualBlockMode();
120 bool startReplaceMode();
122 QChar getChosenRegister(
const QChar &defaultReg)
const;
123 QString getRegisterContent(
const QChar ®);
124 OperationMode getRegisterFlag(
const QChar ®)
const;
125 void fillRegister(
const QChar ®,
const QString &text, OperationMode flag = CharWise);
127 void switchView(Direction direction = Next);
129 KTextEditor::Cursor getNextJump(KTextEditor::Cursor)
const;
130 KTextEditor::Cursor getPrevJump(KTextEditor::Cursor)
const;
132 inline KTextEditor::DocumentPrivate *doc()
const
134 return m_view->doc();
140 Range m_commandRange;
141 unsigned int m_count = 0;
142 int m_oneTimeCountOverride = -1;
143 bool m_iscounted =
false;
145 QString m_extraWordCharacters;
146 QString m_keysVerbatim;
148 int m_stickyColumn = -1;
149 bool m_lastMotionWasVisualLineUpOrDown;
150 bool m_currentMotionWasVisualLineUpOrDown;
152 KTextEditor::ViewPrivate *m_view;
153 KateViewInternal *m_viewInternal;
154 InputModeManager *m_viInputModeManager;
157 QPointer<KTextEditor::Message> m_infoMessage;
Backend of KTextEditor::Document related public KTextEditor interfaces.
This class holds a Message to display in Views.
The KTextEditor namespace contains all the public API that is required to use the KTextEditor compone...