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

Kate

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