Kate
kateviinputmodemanager.cpp
Go to the documentation of this file.
73 m_keyMapperStack.push(QSharedPointer<KateViKeyMapper>(new KateViKeyMapper(this, m_view->doc(), m_view)));
99 m_view->setCursorPosition(Cursor(view->selectionRange().end().line(), view->selectionRange().end().column() - 1));
118 const bool isSyntheticSearchCompletedKeyPress = m_view->viModeEmulatedCommandBar()->isSendingSyntheticSearchCompletedKeypress();
120 // With macros, we want to record the keypresses *before* they are mapped, but if they end up *not* being part
122 // the "!isPlayingBackRejectedKeys()". And obviously, since we're recording keys before they are mapped, we don't
123 // want to also record the executed mapping, as when we replayed the macro, we'd get duplication!
124 if (isRecordingMacro() && !isReplayingMacro() && !isSyntheticSearchCompletedKeyPress && !keyMapper()->isExecutingMapping() && !keyMapper()->isPlayingBackRejectedKeys())
137 if (e->key() != Qt::Key_Control && e->key() != Qt::Key_Shift && e->key() != Qt::Key_Alt && e->key() != Qt::Key_Meta)
304 keyPress.append( keyCode <= 0xFF ? QChar( keyCode ) : KateViKeyParser::self()->qt2vi( keyCode ) );
338 KateGlobal::self()->viInputModeGlobal()->storeMacro(m_recordingMacroRegister, m_currentMacroKeyEventsLog, m_currentMacroCompletionsLog);
354 const QString macroAsFeedableKeypresses = KateGlobal::self()->viInputModeGlobal()->getMacro(macroRegister);
359 m_macroCompletionsToReplay.push(KateGlobal::self()->viInputModeGlobal()->getMacroCompletions(macroRegister));
360 m_keyMapperStack.push(QSharedPointer<KateViKeyMapper>(new KateViKeyMapper(this, m_view->doc(), m_view)));
374 void KateViInputModeManager::logCompletionEvent(const KateViInputModeManager::Completion& completion)
395 kDebug(13070) << "Something wrong here: requesting more completions for last change than we actually have. Returning dummy.";
404 kDebug(13070) << "Something wrong here: requesting more completions for macro than we actually have. Returning dummy.";
463 return ((m_currentViMode == VisualMode) || (m_currentViMode == VisualLineMode) || (m_currentViMode == VisualBlockMode));
519 m_currentChangeKeyEventsLog.append(QKeyEvent(QEvent::KeyPress, QString("i")[0].unicode(), Qt::NoModifier, "i"));
600 KateGlobal::self()->viInputModeGlobal()->fillRegister( names.at( i ).at( 0 ), contents.at( i ), (OperationMode)( flags.at( i ) ) );
627 const QMap<QChar, KateViRegister>* regs = KateGlobal::self()->viInputModeGlobal()->getRegisters();
918 KateViInputModeManager::Completion::Completion(const QString& completedText, bool removeTail, CompletionType completionType)
925 kDebug(13070) << "Completing a function while not removing tail currently unsupported; will remove tail instead";
937 KateViInputModeManager::Completion::CompletionType KateViInputModeManager::Completion::completionType() const
void cursorPrevChar(bool sel=false)
Definition: kateviewinternal.cpp:1092
const QString getVerbatimKeys() const
Definition: kateviinputmodemanager.cpp:566
void clear()
Definition: kateviinputmodemanager.h:50
void viEnterNormalMode()
set normal mode to be the active vi mode and perform the needed setup work
Definition: kateviinputmodemanager.cpp:484
void replayMacro(QChar macroRegister)
Definition: kateviinputmodemanager.cpp:346
void finishRecordingMacro()
Definition: kateviinputmodemanager.cpp:334
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
Qt::KeyboardModifiers modifiers() const
QString & append(QChar ch)
Type type() const
QScriptValue i18n(QScriptContext *context, QScriptEngine *engine)
i18n("text", arguments [optional])
Definition: katescripthelpers.cpp:186
bool getTemporaryNormalMode()
Definition: kateviinputmodemanager.h:239
Definition: katerenderer.h:71
virtual KTextEditor::MovingCursor * newMovingCursor(const KTextEditor::Cursor &position, KTextEditor::MovingCursor::InsertBehavior insertBehavior=KTextEditor::MovingCursor::MoveOnInsert)
Create a new moving cursor for this document.
Definition: katedocument.cpp:4736
bool contains(const Key &key) const
void syncViMarksAndBookmarks()
Definition: kateviinputmodemanager.cpp:820
char toAscii() const
T pop()
void push_back(const T &value)
void addMark(KateDocument *doc, const QChar &mark, const KTextEditor::Cursor &pos, const bool moveoninsert=true, const bool showmark=true)
Add a mark to the document.
Definition: kateviinputmodemanager.cpp:737
virtual KTextEditor::View * activeView() const
Definition: katedocument.h:156
void setCaretStyle(KateRenderer::caretStyles style, bool repaint=false)
Set the caret's style.
Definition: kateview.cpp:2413
void changeViMode(ViMode newMode)
changes the current vi mode to the given mode
Definition: kateviinputmodemanager.cpp:445
ViMode getPreviousViMode() const
Definition: kateviinputmodemanager.cpp:456
void push(const T &t)
void storeMacro(QChar macroRegister, const QList< QKeyEvent > macroKeyEventLog, const QList< KateViInputModeManager::Completion > completions)
Definition: kateviglobal.cpp:302
const_iterator constBegin() const
Definition: katevimodebase.h:64
const T & at(int i) const
Definition: kateviinputmodemanager.h:51
Definition: kateviinputmodemanager.h:54
void startRecordingMacro(QChar macroRegister)
Definition: kateviinputmodemanager.cpp:323
iterator erase(iterator pos)
KateViInputModeManager(KateView *view, KateViewInternal *viewInternal)
Definition: kateviinputmodemanager.cpp:50
Definition: kateviinputmodemanager.h:49
bool isSendingSyntheticSearchCompletedKeypress()
Definition: kateviemulatedcommandbar.cpp:1217
QString & remove(int position, int n)
const QChar KeyEventToQChar(const QKeyEvent &keyEvent)
Definition: katevikeyparser.cpp:674
void doNotLogCurrentKeypress()
Definition: kateviinputmodemanager.cpp:411
bool setCursorPosition(KTextEditor::Cursor position)
Definition: kateview.cpp:2418
void update()
Definition: kateviinputmodemanager.h:57
Definition: katedefaultcolors.h:56
void updateSelection()
Updates the visual mode's range to reflect a new cursor position.
Definition: katevivisualmode.cpp:237
int size() const
KTextEditor::Cursor getNextJump(KTextEditor::Cursor cursor)
Definition: kateviinputmodemanager.cpp:687
QString completedText() const
Definition: kateviinputmodemanager.cpp:929
void clear()
virtual const KTextEditor::Range & selectionRange() const
Definition: kateview.cpp:2815
QList< Key > keys() const
void addJump(KTextEditor::Cursor cursor)
Definition: kateviinputmodemanager.cpp:668
QString getMacro(QChar macroRegister)
Get the named macro in a format suitable for passing to feedKeyPresses.
Definition: kateviglobal.cpp:316
~KateViInputModeManager()
Definition: kateviinputmodemanager.cpp:104
QString number(int n, int base)
const QString getLastSearchPattern() const
The current search pattern.
Definition: kateviinputmodemanager.cpp:422
void append(const T &value)
CompletionType completionType() const
Definition: kateviinputmodemanager.cpp:937
Completion(const QString &completedText, bool removeTail, CompletionType completionType)
Definition: kateviinputmodemanager.cpp:918
const_iterator constEnd() const
virtual bool handleKeypress(const QKeyEvent *e)=0
Definition: katerenderer.h:72
void beginMonitoringDocumentChanges()
Definition: katevinormalmode.cpp:486
bool isEmpty() const
Definition: kateviewinternal.h:58
bool isEmpty() const
KateViKeyMapper * keyMapper()
Definition: kateviinputmodemanager.cpp:913
QWidget * focusWidget()
const QString decodeKeySequence(const QString &keys) const
Definition: katevikeyparser.cpp:632
const_iterator constEnd() const
KTextEditor::Cursor getMarkPosition(const QChar &mark) const
Definition: kateviinputmodemanager.cpp:781
KateViNormalMode * getViNormalMode()
Definition: kateviinputmodemanager.cpp:546
bool sendEvent(QObject *receiver, QEvent *event)
QString text() const
const QMap< QChar, KateViRegister > * getRegisters() const
Definition: kateviglobal.h:58
void viEnterVisualMode(ViMode visualMode=VisualMode)
set visual mode to be the active vi mode and make the needed setup work
Definition: kateviinputmodemanager.cpp:526
Definition: katevivisualmode.h:34
KateViModeBase * getCurrentViModeHandler() const
Definition: kateviinputmodemanager.cpp:466
bool removeTail() const
Definition: kateviinputmodemanager.cpp:933
void writeSessionConfig(KConfigGroup &config)
Definition: kateviinputmodemanager.cpp:624
Definition: katerenderer.h:70
ushort unicode() const
Definition: katevikeymapper.h:33
void pop_back()
const QString encodeKeySequence(const QString &keys) const
Definition: katevikeyparser.cpp:520
Definition: kateview.h:77
Definition: kateviinputmodemanager.h:53
iterator end()
int key() const
void setSearchPattern(const QString &searchPattern)
Set the current search pattern.
Definition: kateview.cpp:2476
Definition: katedocument.h:74
CompletionType
Definition: kateviinputmodemanager.h:188
void readSessionConfig(const KConfigGroup &config)
Definition: kateviinputmodemanager.cpp:588
KateViReplaceMode * getViReplaceMode()
Definition: kateviinputmodemanager.cpp:561
void setVisualModeType(ViMode mode)
Definition: katevivisualmode.cpp:213
Definition: kateviinputmodemanager.h:52
void storeLastChangeCommand()
copy the contents of the key events log to m_lastChange so that it can be repeated ...
Definition: kateviinputmodemanager.cpp:279
const_iterator constBegin() const
bool handleKeyPress(const QKeyEvent *keyEvent)
Definition: kateviemulatedcommandbar.cpp:927
bool handleKeypress(const QKeyEvent *e)
feed key the given key press to the command parser
Definition: kateviinputmodemanager.cpp:113
QChar toUpper() const
bool isReplayingMacro()
Definition: kateviinputmodemanager.cpp:369
void appendKeyEventToLog(const QKeyEvent &e)
append a QKeyEvent to the key event log
Definition: kateviinputmodemanager.cpp:271
KateViEmulatedCommandBar * viModeEmulatedCommandBar()
Definition: kateview.cpp:3051
virtual void removeMark(int line, uint markType)
Definition: katedocument.cpp:1714
QWidget * activePopupWidget()
const QChar at(int position) const
KTextEditor::Cursor getPrevJump(KTextEditor::Cursor cursor)
Definition: kateviinputmodemanager.cpp:704
bool isReplayingLastChange() const
Definition: kateviinputmodemanager.h:163
bool isRecordingMacro()
Definition: kateviinputmodemanager.cpp:341
void setLastSearchPattern(const QString &p)
Set the current search pattern.
Definition: kateviinputmodemanager.cpp:434
static QString modeToString(ViMode mode)
convert mode to string representation for user
Definition: kateviinputmodemanager.cpp:886
int length() const
void logCompletionEvent(const Completion &completion)
Definition: kateviinputmodemanager.cpp:374
virtual QString text(const KTextEditor::Range &range, bool blockwise=false) const
Definition: katedocument.cpp:337
QWidget * focusProxy() const
virtual const QHash< int, KTextEditor::Mark * > & marks()
Definition: katedocument.cpp:1747
iterator insert(const Key &key, const T &value)
KateViInsertMode * getViInsertMode()
Definition: kateviinputmodemanager.cpp:551
void repeatLastChange()
repeat last change by feeding the contents of m_lastChange to feedKeys()
Definition: kateviinputmodemanager.cpp:315
Completion nextLoggedCompletion()
Definition: kateviinputmodemanager.cpp:388
KateViVisualMode * getViVisualMode()
Definition: kateviinputmodemanager.cpp:556
ViMode getCurrentViMode() const
Definition: kateviinputmodemanager.cpp:451
void feedKeyPresses(const QString &keyPresses) const
feed key the given list of key presses to the key handling code, one by one
Definition: kateviinputmodemanager.cpp:172
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Definition: kateviinsertmode.h:45
void fillRegister(const QChar ®, const QString &text, OperationMode flag=CharWise)
Definition: kateviglobal.cpp:146
void setTemporaryNormalMode(bool b)
Definition: kateviinputmodemanager.h:241
iterator begin()
bool isAnyVisualMode() const
Definition: kateviinputmodemanager.cpp:461
bool isHandlingKeypress() const
Determines whether we are currently processing a Vi keypress.
Definition: kateviinputmodemanager.cpp:266
void viEnterInsertMode()
set insert mode to be the active vi mode and perform the needed setup work
Definition: kateviinputmodemanager.cpp:511
void viEnterReplaceMode()
set replace mode to be the active vi mode and make the needed setup work
Definition: kateviinputmodemanager.cpp:538
const T value(const Key &key) const
int remove(const Key &key)
QString getMarksOnTheLine(int line)
Definition: kateviinputmodemanager.cpp:872
typedef KeyboardModifiers
T & top()
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:59 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:59 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.