• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

Kate

  • kde-4.14
  • applications
  • kate
  • part
  • vimode
kateviinputmodemanager.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE libraries and the Kate part.
2  *
3  * Copyright (C) 2008 - 2009 Erlend Hamberg <ehamberg@gmail.com>
4  * Copyright (C) 2009 Paul Gideon Dann <pdgiddie@gmail.com>
5  * Copyright (C) 2011 Svyatoslav Kuzmich <svatoslav1@gmail.com>
6  * Copyright (C) 2012 - 2013 Simon St James <kdedevel@etotheipiplusone.com>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public License
19  * along with this library; see the file COPYING.LIB. If not, write to
20  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  */
23 
24 #include "kateviinputmodemanager.h"
25 
26 #include <QKeyEvent>
27 #include <QString>
28 #include <QApplication>
29 
30 #include <kconfig.h>
31 #include <kconfiggroup.h>
32 
33 #include "kateconfig.h"
34 #include "kateglobal.h"
35 #include "kateviglobal.h"
36 #include "katevinormalmode.h"
37 #include "kateviinsertmode.h"
38 #include "katevivisualmode.h"
39 #include "katevireplacemode.h"
40 #include "katevikeyparser.h"
41 #include "katevikeymapper.h"
42 #include "kateviemulatedcommandbar.h"
43 
44 using KTextEditor::Cursor;
45 using KTextEditor::Document;
46 using KTextEditor::Mark;
47 using KTextEditor::MarkInterface;
48 using KTextEditor::MovingCursor;
49 
50 KateViInputModeManager::KateViInputModeManager(KateView* view, KateViewInternal* viewInternal)
51 {
52  m_viNormalMode = new KateViNormalMode(this, view, viewInternal);
53  m_viInsertMode = new KateViInsertMode(this, view, viewInternal);
54  m_viVisualMode = new KateViVisualMode(this, view, viewInternal);
55  m_viReplaceMode = new KateViReplaceMode(this, view, viewInternal);
56 
57  m_currentViMode = NormalMode;
58  m_previousViMode = NormalMode;
59 
60  m_view = view;
61  m_viewInternal = viewInternal;
62 
63  m_view->setCaretStyle( KateRenderer::Block, true );
64 
65  m_insideHandlingKeyPressCount = 0;
66 
67  m_isReplayingLastChange = false;
68 
69  m_isRecordingMacro = false;
70  m_macrosBeingReplayedCount = 0;
71  m_lastPlayedMacroRegister = QChar::Null;
72 
73  m_keyMapperStack.push(QSharedPointer<KateViKeyMapper>(new KateViKeyMapper(this, m_view->doc(), m_view)));
74 
75  m_lastSearchBackwards = false;
76  m_lastSearchCaseSensitive = false;
77  m_lastSearchPlacedCursorAtEndOfMatch = false;
78 
79  jump_list = new QList<KateViJump>;
80  current_jump = jump_list->begin();
81  m_temporaryNormalMode = false;
82 
83  m_markSetInsideViInputModeManager = false;
84 
85  connect(m_view->doc(),
86  SIGNAL(markChanged(KTextEditor::Document*, KTextEditor::Mark,
87  KTextEditor::MarkInterface::MarkChangeAction)),
88  this,
89  SLOT(markChanged(KTextEditor::Document*, KTextEditor::Mark,
90  KTextEditor::MarkInterface::MarkChangeAction)));
91  // We have to do this outside of KateViNormalMode, as we don't want
92  // KateViVisualMode (which inherits from KateViNormalMode) to respond
93  // to changes in the document as well.
94  m_viNormalMode->beginMonitoringDocumentChanges();
95 
96  if (view->selection())
97  {
98  changeViMode(VisualMode);
99  m_view->setCursorPosition(Cursor(view->selectionRange().end().line(), view->selectionRange().end().column() - 1));
100  m_viVisualMode->updateSelection();
101  }
102 }
103 
104 KateViInputModeManager::~KateViInputModeManager()
105 {
106  delete m_viNormalMode;
107  delete m_viInsertMode;
108  delete m_viVisualMode;
109  delete m_viReplaceMode;
110  delete jump_list;
111 }
112 
113 bool KateViInputModeManager::handleKeypress(const QKeyEvent *e)
114 {
115  m_insideHandlingKeyPressCount++;
116  bool res = false;
117  bool keyIsPartOfMapping = false;
118  const bool isSyntheticSearchCompletedKeyPress = m_view->viModeEmulatedCommandBar()->isSendingSyntheticSearchCompletedKeypress();
119 
120  // With macros, we want to record the keypresses *before* they are mapped, but if they end up *not* being part
121  // of a mapping, we don't want to record them when they are played back by m_keyMapper, hence
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())
125  {
126  QKeyEvent copy( e->type(), e->key(), e->modifiers(), e->text() );
127  m_currentMacroKeyEventsLog.append(copy);
128  }
129 
130  if (!isReplayingLastChange() && !isSyntheticSearchCompletedKeyPress)
131  {
132  if (e->key() == Qt::Key_AltGr) {
133  return true; // do nothing:)
134  }
135 
136  // Hand off to the key mapper, and decide if this key is part of a mapping.
137  if (e->key() != Qt::Key_Control && e->key() != Qt::Key_Shift && e->key() != Qt::Key_Alt && e->key() != Qt::Key_Meta)
138  {
139  const QChar key = KateViKeyParser::self()->KeyEventToQChar(*e);
140  if (keyMapper()->handleKeypress(key))
141  {
142  keyIsPartOfMapping = true;
143  res = true;
144  }
145  }
146  }
147 
148  if (!keyIsPartOfMapping)
149  {
150  if (!isReplayingLastChange() && !isSyntheticSearchCompletedKeyPress) {
151  // record key press so that it can be repeated via "."
152  QKeyEvent copy( e->type(), e->key(), e->modifiers(), e->text() );
153  appendKeyEventToLog( copy );
154  }
155 
156  if (m_view->viModeEmulatedCommandBar()->isActive())
157  {
158  res = m_view->viModeEmulatedCommandBar()->handleKeyPress(e);
159  }
160  else
161  {
162  res = getCurrentViModeHandler()->handleKeypress(e);
163  }
164  }
165 
166  m_insideHandlingKeyPressCount--;
167  Q_ASSERT(m_insideHandlingKeyPressCount >= 0);
168 
169  return res;
170 }
171 
172 void KateViInputModeManager::feedKeyPresses(const QString &keyPresses) const
173 {
174  int key;
175  Qt::KeyboardModifiers mods;
176  QString text;
177 
178  foreach(const QChar &c, keyPresses) {
179  QString decoded = KateViKeyParser::self()->decodeKeySequence(QString(c));
180  key = -1;
181  mods = Qt::NoModifier;
182  text.clear();
183 
184  kDebug( 13070 ) << "\t" << decoded;
185 
186  if (decoded.length() > 1 ) { // special key
187 
188  // remove the angle brackets
189  decoded.remove(0, 1);
190  decoded.remove(decoded.indexOf(">"), 1);
191  kDebug( 13070 ) << "\t Special key:" << decoded;
192 
193  // check if one or more modifier keys where used
194  if (decoded.indexOf("s-") != -1 || decoded.indexOf("c-") != -1
195  || decoded.indexOf("m-") != -1 || decoded.indexOf("a-") != -1) {
196 
197  int s = decoded.indexOf("s-");
198  if (s != -1) {
199  mods |= Qt::ShiftModifier;
200  decoded.remove(s, 2);
201  }
202 
203  int c = decoded.indexOf("c-");
204  if (c != -1) {
205  mods |= Qt::ControlModifier;
206  decoded.remove(c, 2);
207  }
208 
209  int a = decoded.indexOf("a-");
210  if (a != -1) {
211  mods |= Qt::AltModifier;
212  decoded.remove(a, 2);
213  }
214 
215  int m = decoded.indexOf("m-");
216  if (m != -1) {
217  mods |= Qt::MetaModifier;
218  decoded.remove(m, 2);
219  }
220 
221  if (decoded.length() > 1 ) {
222  key = KateViKeyParser::self()->vi2qt(decoded);
223  } else if (decoded.length() == 1) {
224  key = int(decoded.at(0).toUpper().toAscii());
225  text = decoded.at(0);
226  kDebug( 13070 ) << "###########" << key;
227  } else {
228  kWarning( 13070 ) << "decoded is empty. skipping key press.";
229  }
230  } else { // no modifiers
231  key = KateViKeyParser::self()->vi2qt(decoded);
232  }
233  } else {
234  key = decoded.at(0).unicode();
235  text = decoded.at(0);
236  }
237 
238  // We have to be clever about which widget we dispatch to, as we can trigger
239  // shortcuts if we're not careful (even if Vim mode is configured to steal shortcuts).
240  QKeyEvent k(QEvent::KeyPress, key, mods, text);
241  QWidget *destWidget = NULL;
242  if (QApplication::activePopupWidget())
243  {
244  // According to the docs, the activePopupWidget, if present, takes all events.
245  destWidget = QApplication::activePopupWidget();
246  }
247  else if (QApplication::focusWidget())
248  {
249  if (QApplication::focusWidget()->focusProxy())
250  {
251  destWidget = QApplication::focusWidget()->focusProxy();
252  }
253  else
254  {
255  destWidget = QApplication::focusWidget();
256  }
257  }
258  else
259  {
260  destWidget = m_view->focusProxy();
261  }
262  QApplication::sendEvent(destWidget, &k);
263  }
264 }
265 
266 bool KateViInputModeManager::isHandlingKeypress() const
267 {
268  return m_insideHandlingKeyPressCount > 0;
269 }
270 
271 void KateViInputModeManager::appendKeyEventToLog(const QKeyEvent &e)
272 {
273  if ( e.key() != Qt::Key_Shift && e.key() != Qt::Key_Control
274  && e.key() != Qt::Key_Meta && e.key() != Qt::Key_Alt ) {
275  m_currentChangeKeyEventsLog.append(e);
276  }
277 }
278 
279 void KateViInputModeManager::storeLastChangeCommand()
280 {
281  m_lastChange.clear();
282 
283  QList<QKeyEvent> keyLog = m_currentChangeKeyEventsLog;
284 
285  for (int i = 0; i < keyLog.size(); i++) {
286  int keyCode = keyLog.at(i).key();
287  QString text = keyLog.at(i).text();
288  int mods = keyLog.at(i).modifiers();
289  QChar key;
290 
291  if ( text.length() > 0 ) {
292  key = text.at(0);
293  }
294 
295  if ( text.isEmpty() || ( text.length() ==1 && text.at(0) < 0x20 )
296  || ( mods != Qt::NoModifier && mods != Qt::ShiftModifier ) ) {
297  QString keyPress;
298 
299  keyPress.append( '<' );
300  keyPress.append( ( mods & Qt::ShiftModifier ) ? "s-" : "" );
301  keyPress.append( ( mods & Qt::ControlModifier ) ? "c-" : "" );
302  keyPress.append( ( mods & Qt::AltModifier ) ? "a-" : "" );
303  keyPress.append( ( mods & Qt::MetaModifier ) ? "m-" : "" );
304  keyPress.append( keyCode <= 0xFF ? QChar( keyCode ) : KateViKeyParser::self()->qt2vi( keyCode ) );
305  keyPress.append( '>' );
306 
307  key = KateViKeyParser::self()->encodeKeySequence( keyPress ).at( 0 );
308  }
309 
310  m_lastChange.append(key);
311  }
312  m_lastChangeCompletionsLog = m_currentChangeCompletionsLog;
313 }
314 
315 void KateViInputModeManager::repeatLastChange()
316 {
317  m_isReplayingLastChange = true;
318  m_nextLoggedLastChangeComplexIndex = 0;
319  feedKeyPresses(m_lastChange);
320  m_isReplayingLastChange = false;
321 }
322 
323 void KateViInputModeManager::startRecordingMacro(QChar macroRegister)
324 {
325  Q_ASSERT(!m_isRecordingMacro);
326  kDebug(13070) << "Recording macro: " << macroRegister;
327  m_isRecordingMacro = true;
328  m_recordingMacroRegister = macroRegister;
329  KateGlobal::self()->viInputModeGlobal()->clearMacro(macroRegister);
330  m_currentMacroKeyEventsLog.clear();
331  m_currentMacroCompletionsLog.clear();
332 }
333 
334 void KateViInputModeManager::finishRecordingMacro()
335 {
336  Q_ASSERT(m_isRecordingMacro);
337  m_isRecordingMacro = false;
338  KateGlobal::self()->viInputModeGlobal()->storeMacro(m_recordingMacroRegister, m_currentMacroKeyEventsLog, m_currentMacroCompletionsLog);
339 }
340 
341 bool KateViInputModeManager::isRecordingMacro()
342 {
343  return m_isRecordingMacro;
344 }
345 
346 void KateViInputModeManager::replayMacro(QChar macroRegister)
347 {
348  if (macroRegister == '@')
349  {
350  macroRegister = m_lastPlayedMacroRegister;
351  }
352  m_lastPlayedMacroRegister = macroRegister;
353  kDebug(13070) << "Replaying macro: " << macroRegister;
354  const QString macroAsFeedableKeypresses = KateGlobal::self()->viInputModeGlobal()->getMacro(macroRegister);
355  kDebug(13070) << "macroAsFeedableKeypresses: " << macroAsFeedableKeypresses;
356 
357  m_macrosBeingReplayedCount++;
358  m_nextLoggedMacroCompletionIndex.push(0);
359  m_macroCompletionsToReplay.push(KateGlobal::self()->viInputModeGlobal()->getMacroCompletions(macroRegister));
360  m_keyMapperStack.push(QSharedPointer<KateViKeyMapper>(new KateViKeyMapper(this, m_view->doc(), m_view)));
361  feedKeyPresses(macroAsFeedableKeypresses);
362  m_keyMapperStack.pop();
363  m_macroCompletionsToReplay.pop();
364  m_nextLoggedMacroCompletionIndex.pop();
365  m_macrosBeingReplayedCount--;
366  kDebug(13070) << "Finished replaying: " << macroRegister;
367 }
368 
369 bool KateViInputModeManager::isReplayingMacro()
370 {
371  return m_macrosBeingReplayedCount > 0;
372 }
373 
374 void KateViInputModeManager::logCompletionEvent(const KateViInputModeManager::Completion& completion)
375 {
376  // Ctrl-space is a special code that means: if you're replaying a macro, fetch and execute
377  // the next logged completion.
378  QKeyEvent ctrlSpace( QKeyEvent::KeyPress, Qt::Key_Space, Qt::ControlModifier, " ");
379  if (isRecordingMacro())
380  {
381  m_currentMacroKeyEventsLog.append(ctrlSpace);
382  m_currentMacroCompletionsLog.append(completion);
383  }
384  m_currentChangeKeyEventsLog.append(ctrlSpace);
385  m_currentChangeCompletionsLog.append(completion);
386 }
387 
388 KateViInputModeManager::Completion KateViInputModeManager::nextLoggedCompletion()
389 {
390  Q_ASSERT(isReplayingLastChange() || isReplayingMacro());
391  if (isReplayingLastChange())
392  {
393  if (m_nextLoggedLastChangeComplexIndex >= m_lastChangeCompletionsLog.length())
394  {
395  kDebug(13070) << "Something wrong here: requesting more completions for last change than we actually have. Returning dummy.";
396  return Completion("", false, Completion::PlainText);
397  }
398  return m_lastChangeCompletionsLog[m_nextLoggedLastChangeComplexIndex++];
399  }
400  else
401  {
402  if (m_nextLoggedMacroCompletionIndex.top() >= m_macroCompletionsToReplay.top().length())
403  {
404  kDebug(13070) << "Something wrong here: requesting more completions for macro than we actually have. Returning dummy.";
405  return Completion("", false, Completion::PlainText);
406  }
407  return m_macroCompletionsToReplay.top()[m_nextLoggedMacroCompletionIndex.top()++];
408  }
409 }
410 
411 void KateViInputModeManager::doNotLogCurrentKeypress()
412 {
413  if (m_isRecordingMacro)
414  {
415  Q_ASSERT(!m_currentMacroKeyEventsLog.isEmpty());
416  m_currentMacroKeyEventsLog.pop_back();
417  }
418  Q_ASSERT(!m_currentChangeKeyEventsLog.isEmpty());
419  m_currentChangeKeyEventsLog.pop_back();
420 }
421 
422 const QString KateViInputModeManager::getLastSearchPattern() const
423 {
424  if (!KateViewConfig::global()->viInputModeEmulateCommandBar())
425  {
426  return m_view->searchPattern();
427  }
428  else
429  {
430  return m_lastSearchPattern;
431  }
432 }
433 
434 void KateViInputModeManager::setLastSearchPattern( const QString &p )
435 {
436  if (!KateViewConfig::global()->viInputModeEmulateCommandBar())
437  {
438  // This actually triggers a search, so we definitely don't want it to be called
439  // if we are handle searches ourselves in the Emulated Command Bar.
440  m_view->setSearchPattern(p);
441  }
442  m_lastSearchPattern = p;
443 }
444 
445 void KateViInputModeManager::changeViMode(ViMode newMode)
446 {
447  m_previousViMode = m_currentViMode;
448  m_currentViMode = newMode;
449 }
450 
451 ViMode KateViInputModeManager::getCurrentViMode() const
452 {
453  return m_currentViMode;
454 }
455 
456 ViMode KateViInputModeManager::getPreviousViMode() const
457 {
458  return m_previousViMode;
459 }
460 
461 bool KateViInputModeManager::isAnyVisualMode() const
462 {
463  return ((m_currentViMode == VisualMode) || (m_currentViMode == VisualLineMode) || (m_currentViMode == VisualBlockMode));
464 }
465 
466 KateViModeBase* KateViInputModeManager::getCurrentViModeHandler() const
467 {
468  switch(m_currentViMode) {
469  case NormalMode:
470  return m_viNormalMode;
471  case InsertMode:
472  return m_viInsertMode;
473  case VisualMode:
474  case VisualLineMode:
475  case VisualBlockMode:
476  return m_viVisualMode;
477  case ReplaceMode:
478  return m_viReplaceMode;
479  }
480  kDebug( 13070 ) << "WARNING: Unknown Vi mode.";
481  return NULL;
482 }
483 
484 void KateViInputModeManager::viEnterNormalMode()
485 {
486  bool moveCursorLeft = (m_currentViMode == InsertMode || m_currentViMode == ReplaceMode)
487  && m_viewInternal->getCursor().column() > 0;
488 
489  if ( !isReplayingLastChange() && m_currentViMode == InsertMode ) {
490  // '^ is the insert mark and "^ is the insert register,
491  // which holds the last inserted text
492  Range r( m_view->cursorPosition(), getMarkPosition( '^' ) );
493 
494  if ( r.isValid() ) {
495  QString insertedText = m_view->doc()->text( r );
496  KateGlobal::self()->viInputModeGlobal()->fillRegister( '^', insertedText );
497  }
498 
499  addMark( m_view->doc(), '^', Cursor( m_view->cursorPosition() ), false, false );
500  }
501 
502  changeViMode(NormalMode);
503 
504  if ( moveCursorLeft ) {
505  m_viewInternal->cursorPrevChar();
506  }
507  m_view->setCaretStyle( KateRenderer::Block, true );
508  m_viewInternal->update ();
509 }
510 
511 void KateViInputModeManager::viEnterInsertMode()
512 {
513  changeViMode(InsertMode);
514  addMark( m_view->doc(), '^', Cursor( m_view->cursorPosition() ), false, false );
515  if (getTemporaryNormalMode())
516  {
517  // Ensure the key log contains a request to re-enter Insert mode, else the keystrokes made
518  // after returning from temporary normal mode will be treated as commands!
519  m_currentChangeKeyEventsLog.append(QKeyEvent(QEvent::KeyPress, QString("i")[0].unicode(), Qt::NoModifier, "i"));
520  }
521  m_view->setCaretStyle( KateRenderer::Line, true );
522  setTemporaryNormalMode(false);
523  m_viewInternal->update ();
524 }
525 
526 void KateViInputModeManager::viEnterVisualMode( ViMode mode )
527 {
528  changeViMode( mode );
529 
530  // If the selection is inclusive, the caret should be a block.
531  // If the selection is exclusive, the caret should be a line.
532  m_view->setCaretStyle( KateRenderer::Block, true );
533  m_viewInternal->update();
534  getViVisualMode()->setVisualModeType( mode );
535  getViVisualMode()->init();
536 }
537 
538 void KateViInputModeManager::viEnterReplaceMode()
539 {
540  changeViMode(ReplaceMode);
541  m_view->setCaretStyle( KateRenderer::Underline, true );
542  m_viewInternal->update();
543 }
544 
545 
546 KateViNormalMode* KateViInputModeManager::getViNormalMode()
547 {
548  return m_viNormalMode;
549 }
550 
551 KateViInsertMode* KateViInputModeManager::getViInsertMode()
552 {
553  return m_viInsertMode;
554 }
555 
556 KateViVisualMode* KateViInputModeManager::getViVisualMode()
557 {
558  return m_viVisualMode;
559 }
560 
561 KateViReplaceMode* KateViInputModeManager::getViReplaceMode()
562 {
563  return m_viReplaceMode;
564 }
565 
566 const QString KateViInputModeManager::getVerbatimKeys() const
567 {
568  QString cmd;
569 
570  switch (getCurrentViMode()) {
571  case NormalMode:
572  cmd = m_viNormalMode->getVerbatimKeys();
573  break;
574  case InsertMode:
575  case ReplaceMode:
576  // ...
577  break;
578  case VisualMode:
579  case VisualLineMode:
580  case VisualBlockMode:
581  cmd = m_viVisualMode->getVerbatimKeys();
582  break;
583  }
584 
585  return cmd;
586 }
587 
588 void KateViInputModeManager::readSessionConfig( const KConfigGroup& config )
589 {
590 
591  if ( KateGlobal::self()->viInputModeGlobal()->getRegisters()->size() > 0 ) {
592  QStringList names = config.readEntry( "ViRegisterNames", QStringList() );
593  QStringList contents = config.readEntry( "ViRegisterContents", QStringList() );
594  QList<int> flags = config.readEntry( "ViRegisterFlags", QList<int>() );
595 
596  // sanity check
597  if ( names.size() == contents.size() && contents.size() == flags.size() ) {
598  for ( int i = 0; i < names.size(); i++ ) {
599  if (!names.at(i).isEmpty())
600  KateGlobal::self()->viInputModeGlobal()->fillRegister( names.at( i ).at( 0 ), contents.at( i ), (OperationMode)( flags.at( i ) ) );
601  }
602  }
603  }
604 
605  // Reading jump list
606  // Format: jump1.line, jump1.column, jump2.line, jump2.column, jump3.line, ...
607  jump_list->clear();
608  QStringList jumps = config.readEntry( "JumpList", QStringList() );
609  for (int i = 0; i + 1 < jumps.size(); i+=2) {
610  KateViJump jump = {jumps.at(i).toInt(), jumps.at(i+1).toInt() } ;
611  jump_list->push_back(jump);
612  }
613  current_jump = jump_list->end();
614  PrintJumpList();
615 
616  // Reading marks
617  QStringList marks = config.readEntry("ViMarks", QStringList() );
618  for (int i = 0; i + 2 < marks.size(); i+=3) {
619  addMark(m_view->doc(),marks.at(i).at(0), Cursor(marks.at(i+1).toInt(),marks.at(i+2).toInt()));
620  }
621  syncViMarksAndBookmarks();
622 }
623 
624 void KateViInputModeManager::writeSessionConfig( KConfigGroup& config )
625 {
626  if ( KateGlobal::self()->viInputModeGlobal()->getRegisters()->size() > 0 ) {
627  const QMap<QChar, KateViRegister>* regs = KateGlobal::self()->viInputModeGlobal()->getRegisters();
628  QStringList names, contents;
629  QList<int> flags;
630  QMap<QChar, KateViRegister>::const_iterator i;
631  for (i = regs->constBegin(); i != regs->constEnd(); ++i) {
632  if ( i.value().first.length() <= 1000 ) {
633  names << i.key();
634  contents << i.value().first;
635  flags << int(i.value().second);
636  } else {
637  kDebug( 13070 ) << "Did not save contents of register " << i.key() << ": contents too long ("
638  << i.value().first.length() << " characters)";
639  }
640  }
641 
642  config.writeEntry( "ViRegisterNames", names );
643  config.writeEntry( "ViRegisterContents", contents );
644  config.writeEntry( "ViRegisterFlags", flags );
645  }
646 
647  // Writing Jump List
648  // Format: jump1.line, jump1.column, jump2.line, jump2.column, jump3.line, ...
649  QStringList l;
650  for (int i = 0; i < jump_list->size(); i++)
651  l << QString::number(jump_list->at(i).line) << QString::number(jump_list->at(i).column);
652  config.writeEntry("JumpList",l );
653 
654  // Writing marks;
655  l.clear();
656  foreach (QChar key, m_marks.keys()) {
657  l << key << QString::number(m_marks.value( key )->line())
658  << QString::number(m_marks.value( key )->column());
659  }
660  config.writeEntry("ViMarks",l);
661 }
662 
663 void KateViInputModeManager::reset() {
664  if ( m_viVisualMode)
665  m_viVisualMode->reset();
666 }
667 
668 void KateViInputModeManager::addJump(Cursor cursor) {
669  for (QList<KateViJump>::iterator iterator = jump_list->begin();
670  iterator != jump_list->end();
671  iterator ++){
672  if ((*iterator).line == cursor.line()){
673  jump_list->erase(iterator);
674  break;
675  }
676  }
677 
678  KateViJump jump = { cursor.line(), cursor.column()};
679  jump_list->push_back(jump);
680  current_jump = jump_list->end();
681 
682  // DEBUG
683  PrintJumpList();
684 
685 }
686 
687 Cursor KateViInputModeManager::getNextJump(Cursor cursor ) {
688  if (current_jump != jump_list->end()) {
689  KateViJump jump;
690  if (current_jump + 1 != jump_list->end())
691  jump = *(++current_jump);
692  else
693  jump = *(current_jump);
694 
695  cursor = Cursor(jump.line, jump.column);
696  }
697 
698  // DEBUG
699  PrintJumpList();
700 
701  return cursor;
702 }
703 
704 Cursor KateViInputModeManager::getPrevJump(Cursor cursor ) {
705  if (current_jump == jump_list->end()) {
706  addJump(cursor);
707  current_jump--;
708  }
709 
710  if (current_jump != jump_list->begin()) {
711  KateViJump jump;
712  jump = *(--current_jump);
713  cursor = Cursor(jump.line, jump.column);
714  }
715 
716  // DEBUG
717  PrintJumpList();
718 
719  return cursor;
720 }
721 
722 void KateViInputModeManager::PrintJumpList(){
723  kDebug( 13070 ) << "Jump List";
724  for ( QList<KateViJump>::iterator iter = jump_list->begin();
725  iter != jump_list->end();
726  iter++){
727  if (iter == current_jump)
728  kDebug( 13070 ) << (*iter).line << (*iter).column << "<< Current Jump";
729  else
730  kDebug( 13070 ) << (*iter).line << (*iter).column;
731  }
732  if (current_jump == jump_list->end())
733  kDebug( 13070 ) << " << Current Jump";
734 
735 }
736 
737 void KateViInputModeManager::addMark( KateDocument* doc, const QChar& mark, const Cursor& pos,
738  const bool moveoninsert, const bool showmark )
739 {
740  m_markSetInsideViInputModeManager = true;
741  uint marktype = m_view->doc()->mark(pos.line());
742 
743  // delete old cursor if any
744  if (MovingCursor *oldCursor = m_marks.value( mark )) {
745 
746  int number_of_marks = 0;
747 
748  foreach (QChar c, m_marks.keys()) {
749  if ( m_marks.value(c)->line() == oldCursor->line() )
750  number_of_marks++;
751  }
752 
753  if (number_of_marks == 1 && pos.line() != oldCursor->line()) {
754  m_view->doc()->removeMark( oldCursor->line(), MarkInterface::markType01 );
755  }
756 
757  delete oldCursor;
758  }
759 
760  MovingCursor::InsertBehavior behavior = moveoninsert ? MovingCursor::MoveOnInsert
761  : MovingCursor::StayOnInsert;
762  // create and remember new one
763  m_marks.insert( mark, doc->newMovingCursor( pos, behavior ) );
764 
765  // Showing what mark we set:
766  if ( showmark && mark != '>' && mark != '<' && mark != '[' && mark != '.' && mark != ']') {
767  if( !marktype & MarkInterface::markType01 ) {
768  m_view->doc()->addMark( pos.line(),
769  MarkInterface::markType01 );
770  }
771 
772  // only show message for active view
773  if (m_view->doc()->activeView() == m_view) {
774  m_viNormalMode->message(i18n ("Mark set: %1", mark));
775  }
776  }
777 
778  m_markSetInsideViInputModeManager = false;
779 }
780 
781 Cursor KateViInputModeManager::getMarkPosition( const QChar& mark ) const
782 {
783  if ( m_marks.contains(mark) ) {
784  MovingCursor* c = m_marks.value( mark );
785  return Cursor( c->line(), c->column() );
786  } else {
787  return Cursor::invalid();
788  }
789 }
790 
791 
792 void KateViInputModeManager::markChanged (Document* doc,
793  Mark mark,
794  MarkInterface::MarkChangeAction action) {
795 
796  Q_UNUSED( doc )
797  if (mark.type != MarkInterface::Bookmark || m_markSetInsideViInputModeManager)
798  {
799  return;
800  }
801  if (action == MarkInterface::MarkRemoved) {
802  foreach (QChar markerChar, m_marks.keys()) {
803  if ( m_marks.value(markerChar)->line() == mark.line )
804  m_marks.remove(markerChar);
805  }
806  } else if (action == MarkInterface::MarkAdded) {
807  bool freeMarkerCharFound = false;
808  for( char markerChar = 'a'; markerChar <= 'z'; markerChar++) {
809  if (!m_marks.value(markerChar)) {
810  addMark(m_view->doc(), markerChar, Cursor(mark.line, 0));
811  freeMarkerCharFound = true;
812  break;
813  }
814  }
815  if (!freeMarkerCharFound)
816  m_viNormalMode->error(i18n ("There are no more chars for the next bookmark."));
817  }
818 }
819 
820 void KateViInputModeManager::syncViMarksAndBookmarks() {
821  const QHash<int, Mark*> &m = m_view->doc()->marks();
822 
823  // Each bookmark should have a vi mark on the same line.
824  for (QHash<int, Mark*>::const_iterator it = m.constBegin(); it != m.constEnd(); ++it)
825  {
826  if (it.value()->type & MarkInterface::markType01 ) {
827  bool thereIsViMarkForThisLine = false;
828  foreach( QChar markerChar, m_marks.keys() ) {
829  if ( m_marks.value(markerChar)->line() == it.value()->line ){
830  thereIsViMarkForThisLine = true;
831  break;
832  }
833  }
834  if ( !thereIsViMarkForThisLine ) {
835  for( char markerChar = 'a'; markerChar <= 'z'; markerChar++ ) {
836  if ( ! m_marks.value(markerChar) ) {
837  addMark( m_view->doc(), markerChar, Cursor( it.value()->line, 0 ) );
838  break;
839  }
840  }
841  }
842  }
843  }
844 
845  // For specific vi mark line should be bookmarked.
846  QList<QChar> marksToSync;
847 
848  foreach(QChar markerChar, m_marks.keys()) {
849  if (QLatin1Char('a') <= markerChar && markerChar <= QLatin1Char('z')) {
850  marksToSync << markerChar;
851  }
852  }
853 
854  foreach(QChar markerChar, marksToSync) {
855  bool thereIsKateMarkForThisLine = false;
856  for (QHash<int, Mark*>::const_iterator it = m.constBegin(); it != m.constEnd(); ++it) {
857  if (it.value()->type & MarkInterface::markType01 ) {
858  if ( m_marks.value(markerChar)->line() == it.value()->line ) {
859  thereIsKateMarkForThisLine = true;
860  break;
861  }
862  if ( !thereIsKateMarkForThisLine) {
863  m_view->doc()->addMark( m_marks.value(markerChar)->line(), MarkInterface::markType01 );
864  }
865  }
866  }
867  }
868 }
869 
870 
871 // Returns a string of marks and columns.
872 QString KateViInputModeManager::getMarksOnTheLine(int line) {
873  QString res = "";
874 
875  if ( m_view->viInputMode() ) {
876  foreach (QChar markerChar, m_marks.keys()) {
877  if ( m_marks.value(markerChar)->line() == line )
878  res += markerChar + ":" + QString::number(m_marks.value(markerChar)->column()) + " ";
879  }
880  }
881 
882  return res;
883 }
884 
885 
886 QString KateViInputModeManager::modeToString(ViMode mode)
887 {
888  QString modeStr;
889  switch (mode) {
890  case InsertMode:
891  modeStr = i18n("VI: INSERT MODE");
892  break;
893  case NormalMode:
894  modeStr = i18n("VI: NORMAL MODE");
895  break;
896  case VisualMode:
897  modeStr = i18n("VI: VISUAL");
898  break;
899  case VisualBlockMode:
900  modeStr = i18n("VI: VISUAL BLOCK");
901  break;
902  case VisualLineMode:
903  modeStr = i18n("VI: VISUAL LINE");
904  break;
905  case ReplaceMode:
906  modeStr = i18n("VI: REPLACE");
907  break;
908  }
909 
910  return modeStr;
911 }
912 
913 KateViKeyMapper* KateViInputModeManager::keyMapper()
914 {
915  return m_keyMapperStack.top().data();
916 }
917 
918 KateViInputModeManager::Completion::Completion(const QString& completedText, bool removeTail, CompletionType completionType)
919  : m_completedText(completedText),
920  m_removeTail(removeTail),
921  m_completionType(completionType)
922 {
923  if (m_completionType == FunctionWithArgs || m_completionType == FunctionWithoutArgs)
924  {
925  kDebug(13070) << "Completing a function while not removing tail currently unsupported; will remove tail instead";
926  m_removeTail = true;
927  }
928 }
929 QString KateViInputModeManager::Completion::completedText() const
930 {
931  return m_completedText;
932 }
933 bool KateViInputModeManager::Completion::removeTail() const
934 {
935  return m_removeTail;
936 }
937 KateViInputModeManager::Completion::CompletionType KateViInputModeManager::Completion::completionType() const
938 {
939  return m_completionType;
940 }
941 
katevinormalmode.h
KateViewInternal::cursorPrevChar
void cursorPrevChar(bool sel=false)
Definition: kateviewinternal.cpp:1092
KateViInputModeManager::getVerbatimKeys
const QString getVerbatimKeys() const
Definition: kateviinputmodemanager.cpp:566
QList::clear
void clear()
InsertMode
Definition: kateviinputmodemanager.h:50
KateViInputModeManager::viEnterNormalMode
void viEnterNormalMode()
set normal mode to be the active vi mode and perform the needed setup work
Definition: kateviinputmodemanager.cpp:484
KateViInputModeManager::replayMacro
void replayMacro(QChar macroRegister)
Definition: kateviinputmodemanager.cpp:346
KateViInputModeManager::finishRecordingMacro
void finishRecordingMacro()
Definition: kateviinputmodemanager.cpp:334
QString::indexOf
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
QWidget
KateViVisualMode::reset
void reset()
Definition: katevivisualmode.cpp:143
QKeyEvent::modifiers
Qt::KeyboardModifiers modifiers() const
kateviemulatedcommandbar.h
QString::append
QString & append(QChar ch)
QEvent::type
Type type() const
Kate::Script::i18n
QScriptValue i18n(QScriptContext *context, QScriptEngine *engine)
i18n("text", arguments [optional])
Definition: katescripthelpers.cpp:186
KateViInputModeManager::getTemporaryNormalMode
bool getTemporaryNormalMode()
Definition: kateviinputmodemanager.h:239
KateRenderer::Block
Definition: katerenderer.h:71
KateViEmulatedCommandBar::isActive
bool isActive()
Definition: kateviemulatedcommandbar.cpp:434
KateDocument::newMovingCursor
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
KateDocument::addMark
virtual void addMark(int line, uint markType)
Definition: katedocument.cpp:1677
QMap::contains
bool contains(const Key &key) const
KateViInputModeManager::syncViMarksAndBookmarks
void syncViMarksAndBookmarks()
Definition: kateviinputmodemanager.cpp:820
QChar::toAscii
char toAscii() const
QStack::pop
T pop()
katevivisualmode.h
QList::push_back
void push_back(const T &value)
KateViInputModeManager::addMark
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
KateDocument::activeView
virtual KTextEditor::View * activeView() const
Definition: katedocument.h:156
QChar
KateView::setCaretStyle
void setCaretStyle(KateRenderer::caretStyles style, bool repaint=false)
Set the caret's style.
Definition: kateview.cpp:2413
KateViInputModeManager::changeViMode
void changeViMode(ViMode newMode)
changes the current vi mode to the given mode
Definition: kateviinputmodemanager.cpp:445
KateViInputModeManager::getPreviousViMode
ViMode getPreviousViMode() const
Definition: kateviinputmodemanager.cpp:456
QStack::push
void push(const T &t)
KateViGlobal::storeMacro
void storeMacro(QChar macroRegister, const QList< QKeyEvent > macroKeyEventLog, const QList< KateViInputModeManager::Completion > completions)
Definition: kateviglobal.cpp:302
QMap::constBegin
const_iterator constBegin() const
KateViModeBase
Definition: katevimodebase.h:64
QList::at
const T & at(int i) const
QMap
VisualMode
Definition: kateviinputmodemanager.h:51
ReplaceMode
Definition: kateviinputmodemanager.h:54
KateView::searchPattern
QString searchPattern() const
The current search pattern.
Definition: kateview.cpp:2458
KateViInputModeManager::startRecordingMacro
void startRecordingMacro(QChar macroRegister)
Definition: kateviinputmodemanager.cpp:323
KateViGlobal::clearMacro
void clearMacro(QChar macroRegister)
Definition: kateviglobal.cpp:297
QList::erase
iterator erase(iterator pos)
KateViInputModeManager::KateViInputModeManager
KateViInputModeManager(KateView *view, KateViewInternal *viewInternal)
Definition: kateviinputmodemanager.cpp:50
KateGlobal::self
static KateGlobal * self()
Kate Part Internal stuff ;)
Definition: kateglobal.cpp:465
NormalMode
Definition: kateviinputmodemanager.h:49
KateViEmulatedCommandBar::isSendingSyntheticSearchCompletedKeypress
bool isSendingSyntheticSearchCompletedKeypress()
Definition: kateviemulatedcommandbar.cpp:1217
QString::remove
QString & remove(int position, int n)
KateViKeyParser::KeyEventToQChar
const QChar KeyEventToQChar(const QKeyEvent &keyEvent)
Definition: katevikeyparser.cpp:674
KateViInputModeManager::doNotLogCurrentKeypress
void doNotLogCurrentKeypress()
Definition: kateviinputmodemanager.cpp:411
KateView::setCursorPosition
bool setCursorPosition(KTextEditor::Cursor position)
Definition: kateview.cpp:2418
QWidget::update
void update()
KateViJump
Definition: kateviinputmodemanager.h:57
Kate::Bookmark
Definition: katedefaultcolors.h:56
KateViVisualMode::updateSelection
void updateSelection()
Updates the visual mode's range to reflect a new cursor position.
Definition: katevivisualmode.cpp:237
QList::size
int size() const
KateViInputModeManager::getNextJump
KTextEditor::Cursor getNextJump(KTextEditor::Cursor cursor)
Definition: kateviinputmodemanager.cpp:687
KateViInputModeManager::Completion::completedText
QString completedText() const
Definition: kateviinputmodemanager.cpp:929
KateDocument::mark
virtual uint mark(int line)
Definition: katedocument.cpp:1646
QString::clear
void clear()
KateView::selectionRange
virtual const KTextEditor::Range & selectionRange() const
Definition: kateview.cpp:2815
kateviinputmodemanager.h
QMap::keys
QList< Key > keys() const
KateViInputModeManager::addJump
void addJump(KTextEditor::Cursor cursor)
Definition: kateviinputmodemanager.cpp:668
KateViGlobal::getMacro
QString getMacro(QChar macroRegister)
Get the named macro in a format suitable for passing to feedKeyPresses.
Definition: kateviglobal.cpp:316
KateViInputModeManager::~KateViInputModeManager
~KateViInputModeManager()
Definition: kateviinputmodemanager.cpp:104
katevikeymapper.h
QString::number
QString number(int n, int base)
KateViInputModeManager::getLastSearchPattern
const QString getLastSearchPattern() const
The current search pattern.
Definition: kateviinputmodemanager.cpp:422
QList::append
void append(const T &value)
KateViInputModeManager::Completion::completionType
CompletionType completionType() const
Definition: kateviinputmodemanager.cpp:937
KateViInputModeManager::Completion::Completion
Completion(const QString &completedText, bool removeTail, CompletionType completionType)
Definition: kateviinputmodemanager.cpp:918
QHash::constEnd
const_iterator constEnd() const
KateViModeBase::handleKeypress
virtual bool handleKeypress(const QKeyEvent *e)=0
KateRenderer::Underline
Definition: katerenderer.h:72
QSharedPointer
KateViJump::line
int line
Definition: kateviinputmodemanager.h:58
QHash
KateViNormalMode::beginMonitoringDocumentChanges
void beginMonitoringDocumentChanges()
Definition: katevinormalmode.cpp:486
KateViVisualMode::init
void init()
Definition: katevivisualmode.cpp:197
KateViInputModeManager::Completion::PlainText
Definition: kateviinputmodemanager.h:188
kateglobal.h
KateViJump::column
int column
Definition: kateviinputmodemanager.h:59
QList::isEmpty
bool isEmpty() const
KateViewInternal
Definition: kateviewinternal.h:58
QString::isEmpty
bool isEmpty() const
KateViInputModeManager::keyMapper
KateViKeyMapper * keyMapper()
Definition: kateviinputmodemanager.cpp:913
QApplication::focusWidget
QWidget * focusWidget()
KateViKeyParser::decodeKeySequence
const QString decodeKeySequence(const QString &keys) const
Definition: katevikeyparser.cpp:632
QMap::constEnd
const_iterator constEnd() const
KateViInputModeManager::getMarkPosition
KTextEditor::Cursor getMarkPosition(const QChar &mark) const
Definition: kateviinputmodemanager.cpp:781
KateViInputModeManager::getViNormalMode
KateViNormalMode * getViNormalMode()
Definition: kateviinputmodemanager.cpp:546
QCoreApplication::sendEvent
bool sendEvent(QObject *receiver, QEvent *event)
QKeyEvent::text
QString text() const
QMap::const_iterator
KateViGlobal::getRegisters
const QMap< QChar, KateViRegister > * getRegisters() const
Definition: kateviglobal.h:58
KateViInputModeManager::viEnterVisualMode
void viEnterVisualMode(ViMode visualMode=VisualMode)
set visual mode to be the active vi mode and make the needed setup work
Definition: kateviinputmodemanager.cpp:526
KateViVisualMode
Definition: katevivisualmode.h:34
KateViInputModeManager::getCurrentViModeHandler
KateViModeBase * getCurrentViModeHandler() const
Definition: kateviinputmodemanager.cpp:466
KateViModeBase::getVerbatimKeys
QString getVerbatimKeys() const
Definition: katevimodebase.cpp:1285
KateViInputModeManager::Completion::removeTail
bool removeTail() const
Definition: kateviinputmodemanager.cpp:933
KateViInputModeManager::writeSessionConfig
void writeSessionConfig(KConfigGroup &config)
Definition: kateviinputmodemanager.cpp:624
ViMode
ViMode
The four vi modes supported by Kate's vi input mode.
Definition: kateviinputmodemanager.h:48
QString
QList< KateViJump >
KateRenderer::Line
Definition: katerenderer.h:70
QChar::unicode
ushort unicode() const
kateviinsertmode.h
Kate::Mark
Mark
Definition: katedefaultcolors.h:55
KateView::selection
virtual bool selection() const
Definition: kateview.cpp:2033
QStringList
KateViKeyMapper
Definition: katevikeymapper.h:33
QList::pop_back
void pop_back()
KateViKeyParser::encodeKeySequence
const QString encodeKeySequence(const QString &keys) const
Definition: katevikeyparser.cpp:520
KateView
Definition: kateview.h:77
VisualBlockMode
Definition: kateviinputmodemanager.h:53
QList::end
iterator end()
KateViModeBase::message
void message(const QString &msg)
Definition: katevimodebase.cpp:1269
QKeyEvent::key
int key() const
KateView::setSearchPattern
void setSearchPattern(const QString &searchPattern)
Set the current search pattern.
Definition: kateview.cpp:2476
KateViModeBase::error
void error(const QString &errorMsg)
Definition: katevimodebase.cpp:1253
KateDocument
Definition: katedocument.h:74
KateViInputModeManager::Completion::CompletionType
CompletionType
Definition: kateviinputmodemanager.h:188
QLatin1Char
KateViInputModeManager::Completion
Definition: kateviinputmodemanager.h:185
KateViInputModeManager::readSessionConfig
void readSessionConfig(const KConfigGroup &config)
Definition: kateviinputmodemanager.cpp:588
KateViNormalMode
Commands for the vi normal mode.
Definition: katevinormalmode.h:49
KateViInputModeManager::getViReplaceMode
KateViReplaceMode * getViReplaceMode()
Definition: kateviinputmodemanager.cpp:561
katevikeyparser.h
KateViVisualMode::setVisualModeType
void setVisualModeType(ViMode mode)
Definition: katevivisualmode.cpp:213
VisualLineMode
Definition: kateviinputmodemanager.h:52
QHash::const_iterator
KateView::cursorPosition
KTextEditor::Cursor cursorPosition() const
Definition: kateview.cpp:2423
QKeyEvent
KateViInputModeManager::storeLastChangeCommand
void storeLastChangeCommand()
copy the contents of the key events log to m_lastChange so that it can be repeated ...
Definition: kateviinputmodemanager.cpp:279
KateGlobal::viInputModeGlobal
KateViGlobal * viInputModeGlobal()
vi input mode global
Definition: kateglobal.h:339
QHash::constBegin
const_iterator constBegin() const
KateViewInternal::getCursor
KTextEditor::Cursor getCursor() const
Definition: kateviewinternal.h:191
KateViEmulatedCommandBar::handleKeyPress
bool handleKeyPress(const QKeyEvent *keyEvent)
Definition: kateviemulatedcommandbar.cpp:927
KateViInputModeManager::handleKeypress
bool handleKeypress(const QKeyEvent *e)
feed key the given key press to the command parser
Definition: kateviinputmodemanager.cpp:113
KateView::viInputMode
bool viInputMode() const
Definition: kateview.cpp:1530
QChar::toUpper
QChar toUpper() const
KateViInputModeManager::isReplayingMacro
bool isReplayingMacro()
Definition: kateviinputmodemanager.cpp:369
KateViInputModeManager::appendKeyEventToLog
void appendKeyEventToLog(const QKeyEvent &e)
append a QKeyEvent to the key event log
Definition: kateviinputmodemanager.cpp:271
KateView::viModeEmulatedCommandBar
KateViEmulatedCommandBar * viModeEmulatedCommandBar()
Definition: kateview.cpp:3051
KateDocument::removeMark
virtual void removeMark(int line, uint markType)
Definition: katedocument.cpp:1714
QApplication::activePopupWidget
QWidget * activePopupWidget()
QString::at
const QChar at(int position) const
KateViInputModeManager::getPrevJump
KTextEditor::Cursor getPrevJump(KTextEditor::Cursor cursor)
Definition: kateviinputmodemanager.cpp:704
KateViInputModeManager::reset
void reset()
Definition: kateviinputmodemanager.cpp:663
OperationMode
OperationMode
Definition: katevimodebase.h:49
KateViInputModeManager::isReplayingLastChange
bool isReplayingLastChange() const
Definition: kateviinputmodemanager.h:163
KateViInputModeManager::isRecordingMacro
bool isRecordingMacro()
Definition: kateviinputmodemanager.cpp:341
KateViInputModeManager::setLastSearchPattern
void setLastSearchPattern(const QString &p)
Set the current search pattern.
Definition: kateviinputmodemanager.cpp:434
KateViInputModeManager::modeToString
static QString modeToString(ViMode mode)
convert mode to string representation for user
Definition: kateviinputmodemanager.cpp:886
QString::length
int length() const
KateViReplaceMode
Commands for the vi replace mode.
Definition: katevireplacemode.h:35
KateViInputModeManager::logCompletionEvent
void logCompletionEvent(const Completion &completion)
Definition: kateviinputmodemanager.cpp:374
katevireplacemode.h
KateDocument::text
virtual QString text(const KTextEditor::Range &range, bool blockwise=false) const
Definition: katedocument.cpp:337
QWidget::focusProxy
QWidget * focusProxy() const
KateDocument::marks
virtual const QHash< int, KTextEditor::Mark * > & marks()
Definition: katedocument.cpp:1747
KateView::doc
KateDocument * doc()
accessor to katedocument pointer
Definition: kateview.h:553
QMap::insert
iterator insert(const Key &key, const T &value)
KateViInputModeManager::getViInsertMode
KateViInsertMode * getViInsertMode()
Definition: kateviinputmodemanager.cpp:551
KateViInputModeManager::repeatLastChange
void repeatLastChange()
repeat last change by feeding the contents of m_lastChange to feedKeys()
Definition: kateviinputmodemanager.cpp:315
KateViInputModeManager::nextLoggedCompletion
Completion nextLoggedCompletion()
Definition: kateviinputmodemanager.cpp:388
KateViInputModeManager::getViVisualMode
KateViVisualMode * getViVisualMode()
Definition: kateviinputmodemanager.cpp:556
KateViInputModeManager::getCurrentViMode
ViMode getCurrentViMode() const
Definition: kateviinputmodemanager.cpp:451
KateViInputModeManager::feedKeyPresses
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
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
KateViInsertMode
Definition: kateviinsertmode.h:45
KateViKeyParser::self
static KateViKeyParser * self()
Definition: katevikeyparser.cpp:38
KateViInputModeManager::PrintJumpList
void PrintJumpList()
Definition: kateviinputmodemanager.cpp:722
kateviglobal.h
kateconfig.h
KateViGlobal::fillRegister
void fillRegister(const QChar &reg, const QString &text, OperationMode flag=CharWise)
Definition: kateviglobal.cpp:146
KateViInputModeManager::setTemporaryNormalMode
void setTemporaryNormalMode(bool b)
Definition: kateviinputmodemanager.h:241
KateViInputModeManager::Completion::FunctionWithArgs
Definition: kateviinputmodemanager.h:188
KateViKeyParser::vi2qt
int vi2qt(const QString &keypress) const
Definition: katevikeyparser.cpp:503
QList::begin
iterator begin()
KateViInputModeManager::isAnyVisualMode
bool isAnyVisualMode() const
Definition: kateviinputmodemanager.cpp:461
KateViInputModeManager::Completion::FunctionWithoutArgs
Definition: kateviinputmodemanager.h:188
KateViInputModeManager::isHandlingKeypress
bool isHandlingKeypress() const
Determines whether we are currently processing a Vi keypress.
Definition: kateviinputmodemanager.cpp:266
KateViInputModeManager::viEnterInsertMode
void viEnterInsertMode()
set insert mode to be the active vi mode and perform the needed setup work
Definition: kateviinputmodemanager.cpp:511
KateViewConfig::global
static KateViewConfig * global()
Definition: kateconfig.h:402
KateViInputModeManager::viEnterReplaceMode
void viEnterReplaceMode()
set replace mode to be the active vi mode and make the needed setup work
Definition: kateviinputmodemanager.cpp:538
QMap::value
const T value(const Key &key) const
QMap::remove
int remove(const Key &key)
KateViInputModeManager::getMarksOnTheLine
QString getMarksOnTheLine(int line)
Definition: kateviinputmodemanager.cpp:872
Qt::KeyboardModifiers
typedef KeyboardModifiers
QStack::top
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

KDE's Doxygen guidelines are available online.

Kate

Skip menu "Kate"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Konsole

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal