• 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
kateviinsertmode.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-2011 Erlend Hamberg <ehamberg@gmail.com>
4  * Copyright (C) 2011 Svyatoslav Kuzmich <svatoslav1@gmail.com>
5  * Copyright (C) 2012 - 2013 Simon St James <kdedevel@etotheipiplusone.com>
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public License
18  * along with this library; see the file COPYING.LIB. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #include "kateviinsertmode.h"
24 #include "kateviinputmodemanager.h"
25 #include "kateview.h"
26 #include "kateviewinternal.h"
27 #include "kateconfig.h"
28 #include "katecompletionwidget.h"
29 #include <katecompletiontree.h>
30 #include "kateglobal.h"
31 #include "katevikeyparser.h"
32 
33 using KTextEditor::Cursor;
34 
35 KateViInsertMode::KateViInsertMode( KateViInputModeManager *viInputModeManager,
36  KateView * view, KateViewInternal * viewInternal ) : KateViModeBase()
37 {
38  m_view = view;
39  m_viewInternal = viewInternal;
40  m_viInputModeManager = viInputModeManager;
41 
42  m_blockInsert = None;
43  m_eolPos = 0;
44  m_count = 1;
45  m_countedRepeatsBeginOnNewLine = false;
46 
47  m_isExecutingCompletion = false;
48 
49  connect(doc(), SIGNAL(textInserted(KTextEditor::Document*,KTextEditor::Range)),
50  this, SLOT(textInserted(KTextEditor::Document*,KTextEditor::Range)));
51 }
52 
53 KateViInsertMode::~KateViInsertMode()
54 {
55 }
56 
57 
58 bool KateViInsertMode::commandInsertFromAbove()
59 {
60  Cursor c( m_view->cursorPosition() );
61 
62  if ( c.line() <= 0 ) {
63  return false;
64  }
65 
66  QString line = doc()->line( c.line()-1 );
67  int tabWidth = doc()->config()->tabWidth();
68  QChar ch = getCharAtVirtualColumn( line, m_view->virtualCursorColumn(), tabWidth );
69 
70  if ( ch == QChar::Null ) {
71  return false;
72  }
73 
74  return doc()->insertText( c, ch );
75 }
76 
77 bool KateViInsertMode::commandInsertFromBelow()
78 {
79  Cursor c( m_view->cursorPosition() );
80 
81  if ( c.line() >= doc()->lines()-1 ) {
82  return false;
83  }
84 
85  QString line = doc()->line( c.line()+1 );
86  int tabWidth = doc()->config()->tabWidth();
87  QChar ch = getCharAtVirtualColumn( line, m_view->virtualCursorColumn(), tabWidth );
88 
89  if ( ch == QChar::Null ) {
90  return false;
91  }
92 
93  return doc()->insertText( c, ch );
94 }
95 
96 bool KateViInsertMode::commandDeleteWord()
97 {
98  Cursor c1( m_view->cursorPosition() );
99  Cursor c2;
100 
101  c2 = findPrevWordStart( c1.line(), c1.column() );
102 
103  if ( c2.line() != c1.line() ) {
104  if ( c1.column() == 0 ) {
105  c2.setColumn( doc()->line( c2.line() ).length() );
106  } else {
107  c2.setColumn( 0 );
108  c2.setLine( c2.line()+1 );
109  }
110  }
111 
112  KateViRange r( c2.line(), c2.column(), c1.line(), c1.column(), ViMotion::ExclusiveMotion );
113 
114  return deleteRange( r, CharWise, false );
115 }
116 
117 bool KateViInsertMode::commandDeleteCharBackward()
118 {
119  kDebug( 13070 ) << "Char backward!\n";
120  Cursor c( m_view->cursorPosition() );
121 
122  KateViRange r( c.line(), c.column()-getCount(), c.line(), c.column(), ViMotion::ExclusiveMotion );
123 
124  if (c.column() == 0) {
125  if (c.line() == 0) {
126  return true;
127  } else {
128  r.startColumn = doc()->line(c.line()-1).length();
129  r.startLine--;
130  }
131  }
132 
133  return deleteRange( r, CharWise );
134 }
135 
136 bool KateViInsertMode::commandNewLine()
137 {
138  doc()->newLine( m_view );
139  return true;
140 }
141 
142 bool KateViInsertMode::commandIndent()
143 {
144  Cursor c( m_view->cursorPosition() );
145  doc()->indent( KTextEditor::Range( c.line(), 0, c.line(), 0), 1 );
146  return true;
147 }
148 
149 bool KateViInsertMode::commandUnindent()
150 {
151  Cursor c( m_view->cursorPosition() );
152  doc()->indent( KTextEditor::Range( c.line(), 0, c.line(), 0), -1 );
153  return true;
154 }
155 
156 bool KateViInsertMode::commandToFirstCharacterInFile()
157 {
158  Cursor c;
159 
160  c.setLine( 0 );
161  c.setColumn( 0 );
162 
163  updateCursor( c );
164 
165  return true;
166 }
167 
168 bool KateViInsertMode::commandToLastCharacterInFile()
169 {
170  Cursor c;
171 
172  int lines = doc()->lines()-1;
173  c.setLine( lines );
174  c.setColumn( doc()->line( lines ).length() );
175 
176  updateCursor( c );
177 
178  return true;
179 }
180 
181 bool KateViInsertMode::commandMoveOneWordLeft()
182 {
183  Cursor c( m_view->cursorPosition() );
184  c = findPrevWordStart( c.line(), c.column() );
185 
186  updateCursor( c );
187  return true;
188 }
189 
190 bool KateViInsertMode::commandMoveOneWordRight()
191 {
192  Cursor c( m_view->cursorPosition() );
193  c = findNextWordStart( c.line(), c.column() );
194 
195  if (!c.isValid())
196  {
197  c = doc()->documentEnd();
198  }
199 
200  updateCursor( c );
201  return true;
202 }
203 
204 bool KateViInsertMode::commandCompleteNext()
205 {
206  if(m_view->completionWidget()->isCompletionActive()) {
207  const QModelIndex oldCompletionItem = m_view->completionWidget()->treeView()->selectionModel()->currentIndex();
208  m_view->completionWidget()->cursorDown();
209  const QModelIndex newCompletionItem = m_view->completionWidget()->treeView()->selectionModel()->currentIndex();
210  if (newCompletionItem == oldCompletionItem)
211  {
212  // Wrap to top.
213  m_view->completionWidget()->top();
214  }
215  } else {
216  m_view->userInvokedCompletion();
217  }
218  return true;
219 }
220 
221 bool KateViInsertMode::commandCompletePrevious()
222 {
223  if(m_view->completionWidget()->isCompletionActive()) {
224  const QModelIndex oldCompletionItem = m_view->completionWidget()->treeView()->selectionModel()->currentIndex();
225  m_view->completionWidget()->cursorUp();
226  const QModelIndex newCompletionItem = m_view->completionWidget()->treeView()->selectionModel()->currentIndex();
227  if (newCompletionItem == oldCompletionItem)
228  {
229  // Wrap to bottom.
230  m_view->completionWidget()->bottom();
231  }
232  } else {
233  m_view->userInvokedCompletion();
234  m_view->completionWidget()->bottom();
235  }
236  return true;
237 }
238 
239 bool KateViInsertMode::commandInsertContentOfRegister(){
240  Cursor c( m_view->cursorPosition() );
241  Cursor cAfter = c;
242  QChar reg = getChosenRegister( m_register );
243 
244  OperationMode m = getRegisterFlag( reg );
245  QString textToInsert = getRegisterContent( reg );
246 
247  if ( textToInsert.isNull() ) {
248  error(i18n("Nothing in register %1", reg ));
249  return false;
250  }
251 
252  if ( m == LineWise ) {
253  textToInsert.chop( 1 ); // remove the last \n
254  c.setColumn( doc()->lineLength( c.line() ) ); // paste after the current line and ...
255  textToInsert.prepend( QChar( '\n' ) ); // ... prepend a \n, so the text starts on a new line
256 
257  cAfter.setLine( cAfter.line()+1 );
258  cAfter.setColumn( 0 );
259  }
260  else
261  {
262  cAfter.setColumn(cAfter.column() + textToInsert.length());
263  }
264 
265  doc()->insertText( c, textToInsert, m == Block );
266 
267  updateCursor( cAfter );
268 
269  return true;
270 }
271 
272 // Start Normal mode just for one command and return to Insert mode
273 bool KateViInsertMode::commandSwitchToNormalModeForJustOneCommand(){
274  m_viInputModeManager->setTemporaryNormalMode(true);
275  m_viInputModeManager->changeViMode(NormalMode);
276  const Cursor cursorPos = m_view->cursorPosition();
277  // If we're at end of the line, move the cursor back one step, as in Vim.
278  if (doc()->line(cursorPos.line()).length() == cursorPos.column())
279  {
280  m_view->setCursorPosition(Cursor(cursorPos.line(), cursorPos.column() - 1));
281  }
282  m_view->setCaretStyle( KateRenderer::Block, true );
283  m_view->updateViModeBarMode();
284  m_viewInternal->repaint();
285  return true;
286 }
287 
292 bool KateViInsertMode::handleKeypress( const QKeyEvent *e )
293 {
294  // backspace should work even if the shift key is down
295  if (e->modifiers() != Qt::ControlModifier && e->key() == Qt::Key_Backspace ) {
296  m_view->backspace();
297  return true;
298  }
299 
300  if(m_keys.isEmpty()){
301  if ( e->modifiers() == Qt::NoModifier ) {
302  switch ( e->key() ) {
303  case Qt::Key_Escape:
304  leaveInsertMode();
305  return true;
306  break;
307  case Qt::Key_Left:
308  m_view->cursorLeft();
309  return true;
310  case Qt::Key_Right:
311  m_view->cursorRight();
312  return true;
313  case Qt::Key_Up:
314  m_view->up();
315  return true;
316  case Qt::Key_Down:
317  m_view->down();
318  return true;
319  case Qt::Key_Delete:
320  m_view->keyDelete();
321  return true;
322  case Qt::Key_Home:
323  m_view->home();
324  return true;
325  case Qt::Key_End:
326  m_view->end();
327  return true;
328  case Qt::Key_PageUp:
329  m_view->pageUp();
330  return true;
331  case Qt::Key_PageDown:
332  m_view->pageDown();
333  return true;
334  case Qt::Key_Enter:
335  case Qt::Key_Return:
336  if (m_view->completionWidget()->isCompletionActive() && !m_viInputModeManager->isReplayingMacro() && !m_viInputModeManager->isReplayingLastChange())
337  {
338  // Filter out Enter/ Return's that trigger a completion when recording macros/ last change stuff; they
339  // will be replaced with the special code "ctrl-space".
340  // (This is why there is a "!m_viInputModeManager->isReplayingMacro()" above.)
341  m_viInputModeManager->doNotLogCurrentKeypress();
342 
343  m_isExecutingCompletion = true;
344  m_textInsertedByCompletion.clear();
345  m_view->completionWidget()->execute();
346  completionFinished();
347  m_isExecutingCompletion = false;
348  return true;
349  }
350  default:
351  return false;
352  break;
353  }
354  } else if ( e->modifiers() == Qt::ControlModifier ) {
355  switch( e->key() ) {
356  case Qt::Key_BracketLeft:
357  case Qt::Key_3:
358  leaveInsertMode();
359  return true;
360  break;
361  case Qt::Key_Space:
362  // We use Ctrl-space as a special code in macros/ last change, which means: if replaying
363  // a macro/ last change, fetch and execute the next completion for this macro/ last change ...
364  if (!m_viInputModeManager->isReplayingMacro() && !m_viInputModeManager->isReplayingLastChange())
365  {
366  commandCompleteNext();
367  // ... therefore, we should not record ctrl-space indiscriminately.
368  m_viInputModeManager->doNotLogCurrentKeypress();
369  }
370  else
371  {
372  replayCompletion();
373  }
374  return true;
375  break;
376  case Qt::Key_C:
377  leaveInsertMode( true );
378  return true;
379  break;
380  case Qt::Key_D:
381  commandUnindent();
382  return true;
383  break;
384  case Qt::Key_E:
385  commandInsertFromBelow();
386  return true;
387  break;
388  case Qt::Key_N:
389  if (!m_viInputModeManager->isReplayingMacro())
390  {
391  commandCompleteNext();
392  }
393  return true;
394  break;
395  case Qt::Key_P:
396  if (!m_viInputModeManager->isReplayingMacro())
397  {
398  commandCompletePrevious();
399  }
400  return true;
401  break;
402  case Qt::Key_T:
403  commandIndent();
404  return true;
405  break;
406  case Qt::Key_W:
407  commandDeleteWord();
408  return true;
409  break;
410  case Qt::Key_J:
411  commandNewLine();
412  return true;
413  break;
414  case Qt::Key_H:
415  commandDeleteCharBackward();
416  return true;
417  break;
418  case Qt::Key_Y:
419  commandInsertFromAbove();
420  return true;
421  break;
422  case Qt::Key_O:
423  commandSwitchToNormalModeForJustOneCommand();
424  return true;
425  break;
426  case Qt::Key_Home:
427  commandToFirstCharacterInFile();
428  return true;
429  break;
430  case Qt::Key_R:
431  m_keys = "cR";
432  // Waiting for register
433  return true;
434  break;
435  case Qt::Key_End:
436  commandToLastCharacterInFile();
437  return true;
438  break;
439  case Qt::Key_Left:
440  commandMoveOneWordLeft();
441  return true;
442  break;
443  case Qt::Key_Right:
444  commandMoveOneWordRight();
445  return true;
446  break;
447  default:
448  return false;
449  }
450  }
451 
452  return false;
453 } else {
454 
455  // Was waiting for register for Ctrl-R
456  if (m_keys == "cR"){
457  QChar key = KateViKeyParser::self()->KeyEventToQChar(*e);
458  key = key.toLower();
459 
460  // is it register ?
461  if ( ( key >= '0' && key <= '9' ) || ( key >= 'a' && key <= 'z' ) ||
462  key == '_' || key == '+' || key == '*' ) {
463  m_register = key;
464  } else {
465  m_keys = "";
466  return false;
467  }
468  commandInsertContentOfRegister();
469  m_keys = "";
470  return true;
471  }
472  }
473  return false;
474 }
475 
476 // leave insert mode when esc, etc, is pressed. if leaving block
477 // prepend/append, the inserted text will be added to all block lines. if
478 // ctrl-c is used to exit insert mode this is not done.
479 void KateViInsertMode::leaveInsertMode( bool force )
480 {
481  m_view->abortCompletion();
482  if ( !force )
483  {
484  if ( m_blockInsert != None ) { // block append/prepend
485 
486  // make sure cursor haven't been moved
487  if ( m_blockRange.startLine == m_view->cursorPosition().line() ) {
488  int start, len;
489  QString added;
490  Cursor c;
491 
492  switch ( m_blockInsert ) {
493  case Append:
494  case Prepend:
495  if ( m_blockInsert == Append ) {
496  start = m_blockRange.endColumn+1;
497  } else {
498  start = m_blockRange.startColumn;
499  }
500 
501  len = m_view->cursorPosition().column()-start;
502  added = getLine().mid( start, len );
503 
504  c = Cursor( m_blockRange.startLine, start );
505  for ( int i = m_blockRange.startLine+1; i <= m_blockRange.endLine; i++ ) {
506  c.setLine( i );
507  doc()->insertText( c, added );
508  }
509  break;
510  case AppendEOL:
511  start = m_eolPos;
512  len = m_view->cursorPosition().column()-start;
513  added = getLine().mid( start, len );
514 
515  c = Cursor( m_blockRange.startLine, start );
516  for ( int i = m_blockRange.startLine+1; i <= m_blockRange.endLine; i++ ) {
517  c.setLine( i );
518  c.setColumn( doc()->lineLength( i ) );
519  doc()->insertText( c, added );
520  }
521  break;
522  default:
523  error("not supported");
524  }
525  }
526 
527  m_blockInsert = None;
528  }
529  else
530  {
531  const QString added = doc()->text(Range(m_viInputModeManager->getMarkPosition('^'), m_view->cursorPosition()));
532 
533  if (m_count > 1)
534  {
535  for (unsigned int i = 0; i < m_count - 1; i++)
536  {
537  if (m_countedRepeatsBeginOnNewLine)
538  {
539  doc()->newLine(m_view);
540  }
541  doc()->insertText( m_view->cursorPosition(), added );
542  }
543  }
544  }
545  }
546  m_countedRepeatsBeginOnNewLine = false;
547  startNormalMode();
548 }
549 
550 void KateViInsertMode::setBlockPrependMode( KateViRange blockRange )
551 {
552  // ignore if not more than one line is selected
553  if ( blockRange.startLine != blockRange.endLine ) {
554  m_blockInsert = Prepend;
555  m_blockRange = blockRange;
556  }
557 }
558 
559 void KateViInsertMode::setBlockAppendMode( KateViRange blockRange, BlockInsert b )
560 {
561  Q_ASSERT( b == Append || b == AppendEOL );
562 
563  // ignore if not more than one line is selected
564  if ( blockRange.startLine != blockRange.endLine ) {
565  m_blockRange = blockRange;
566  m_blockInsert = b;
567  if ( b == AppendEOL ) {
568  m_eolPos = doc()->lineLength( m_blockRange.startLine );
569  }
570  } else {
571  kDebug( 13070 ) << "cursor moved. ignoring block append/prepend";
572  }
573 }
574 
575 void KateViInsertMode::completionFinished()
576 {
577  KateViInputModeManager::Completion::CompletionType completionType = KateViInputModeManager::Completion::PlainText;
578  if (m_view->cursorPosition() != m_textInsertedByCompletionEndPos)
579  {
580  completionType = KateViInputModeManager::Completion::FunctionWithArgs;
581  }
582  else if (m_textInsertedByCompletion.endsWith("()") || m_textInsertedByCompletion.endsWith("();"))
583  {
584  completionType = KateViInputModeManager::Completion::FunctionWithoutArgs;
585  }
586  m_viInputModeManager->logCompletionEvent(KateViInputModeManager::Completion(m_textInsertedByCompletion, KateViewConfig::global()->wordCompletionRemoveTail(), completionType));
587 }
588 
589 void KateViInsertMode::replayCompletion()
590 {
591  const KateViInputModeManager::Completion completion = m_viInputModeManager->nextLoggedCompletion();
592  // Find beginning of the word.
593  Cursor cursorPos = m_view->cursorPosition();
594  Cursor wordStart = Cursor::invalid();
595  if (!doc()->character(cursorPos).isLetterOrNumber() && doc()->character(cursorPos) != '_')
596  {
597  cursorPos.setColumn(cursorPos.column() - 1);
598  }
599  while (cursorPos.column() >= 0 && (doc()->character(cursorPos).isLetterOrNumber() || doc()->character(cursorPos) == '_'))
600  {
601  wordStart = cursorPos;
602  cursorPos.setColumn(cursorPos.column() - 1);
603  }
604  // Find end of current word.
605  cursorPos = m_view->cursorPosition();
606  Cursor wordEnd = Cursor(cursorPos.line(), cursorPos.column() - 1);
607  while (cursorPos.column() < doc()->lineLength(cursorPos.line()) && (doc()->character(cursorPos).isLetterOrNumber() || doc()->character(cursorPos) == '_'))
608  {
609  wordEnd = cursorPos;
610  cursorPos.setColumn(cursorPos.column() + 1);
611  }
612  QString completionText = completion.completedText();
613  const Range currentWord = Range(wordStart, Cursor(wordEnd.line(), wordEnd.column() + 1));
614  // Should we merge opening brackets? Yes, if completion is a function with arguments and after the cursor
615  // there is (optional whitespace) followed by an open bracket.
616  int offsetFinalCursorPosBy = 0;
617  if (completion.completionType() == KateViInputModeManager::Completion::FunctionWithArgs)
618  {
619  const int nextMergableBracketAfterCursorPos = findNextMergeableBracketPos(currentWord.end());
620  if (nextMergableBracketAfterCursorPos != -1)
621  {
622  if (completionText.endsWith("()"))
623  {
624  // Strip "()".
625  completionText = completionText.left(completionText.length() - 2);
626  }
627  else if (completionText.endsWith("();"))
628  {
629  // Strip "();".
630  completionText = completionText.left(completionText.length() - 3);
631  }
632  // Ensure cursor ends up after the merged open bracket.
633  offsetFinalCursorPosBy = nextMergableBracketAfterCursorPos + 1;
634  }
635  else
636  {
637  if (!completionText.endsWith("()") && !completionText.endsWith("();"))
638  {
639  // Original completion merged with an opening bracket; we'll have to add our own brackets.
640  completionText.append("()");
641  }
642  // Position cursor correctly i.e. we'll have added "functionname()" or "functionname();"; need to step back by
643  // one or two to be after the opening bracket.
644  offsetFinalCursorPosBy = completionText.endsWith(";") ? -2 : -1;
645  }
646  }
647  Cursor deleteEnd = completion.removeTail() ? currentWord.end() :
648  Cursor(m_view->cursorPosition().line(), m_view->cursorPosition().column() + 0);
649 
650  if (currentWord.isValid())
651  {
652  doc()->removeText(Range(currentWord.start(), deleteEnd));
653  doc()->insertText(currentWord.start(), completionText);
654  }
655  else
656  {
657  doc()->insertText(m_view->cursorPosition(), completionText);
658  }
659 
660  if (offsetFinalCursorPosBy != 0)
661  {
662  m_view->setCursorPosition(Cursor(m_view->cursorPosition().line(), m_view->cursorPosition().column() + offsetFinalCursorPosBy));
663  }
664 
665  if (!m_viInputModeManager->isReplayingLastChange())
666  {
667  Q_ASSERT(m_viInputModeManager->isReplayingMacro());
668  // Post the completion back: it needs to be added to the "last change" list ...
669  m_viInputModeManager->logCompletionEvent(completion);
670  // ... but don't log the ctrl-space that led to this call to replayCompletion(), as
671  // a synthetic ctrl-space was just added to the last change keypresses by logCompletionEvent(), and we don't
672  // want to duplicate them!
673  m_viInputModeManager->doNotLogCurrentKeypress();
674  }
675 }
676 
677 
678 int KateViInsertMode::findNextMergeableBracketPos(const Cursor& startPos)
679 {
680  const QString lineAfterCursor = doc()->text(Range(startPos, Cursor(startPos.line(), doc()->lineLength(startPos.line()))));
681  QRegExp whitespaceThenOpeningBracket("^\\s*(\\()");
682  int nextMergableBracketAfterCursorPos = -1;
683  if (lineAfterCursor.contains(whitespaceThenOpeningBracket))
684  {
685  nextMergableBracketAfterCursorPos = whitespaceThenOpeningBracket.pos(1);
686  }
687  return nextMergableBracketAfterCursorPos;
688 }
689 
690 void KateViInsertMode::textInserted(KTextEditor::Document* document, KTextEditor::Range range)
691 {
692  if (m_isExecutingCompletion)
693  {
694  m_textInsertedByCompletion += document->text(range);
695  m_textInsertedByCompletionEndPos = range.end();
696  }
697 }
KateDocument::line
virtual QString line(int line) const
Definition: katedocument.cpp:447
KateViRange::endLine
int endLine
Definition: katevirange.h:44
KateView::updateViModeBarMode
void updateViModeBarMode()
Update vi mode statusbar according to the current mode.
Definition: kateview.cpp:1548
KateViInsertMode::handleKeypress
bool handleKeypress(const QKeyEvent *e)
checks if the key is a valid command
Definition: kateviinsertmode.cpp:292
KTextEditor::Range::start
Cursor & start()
KateDocument::config
KateDocumentConfig * config()
Configuration.
Definition: katedocument.h:1009
KateView::userInvokedCompletion
void userInvokedCompletion()
Definition: kateview.cpp:2926
KateViInsertMode::replayCompletion
void replayCompletion()
Definition: kateviinsertmode.cpp:589
kateview.h
Kate::Script::i18n
QScriptValue i18n(QScriptContext *context, QScriptEngine *engine)
i18n("text", arguments [optional])
Definition: katescripthelpers.cpp:186
KateRenderer::Block
Definition: katerenderer.h:71
KateViModeBase::getRegisterFlag
OperationMode getRegisterFlag(const QChar &reg) const
Definition: katevimodebase.cpp:963
KateView::end
void end()
Definition: kateview.cpp:2650
CharWise
Definition: katevimodebase.h:50
KTextEditor::Range::isValid
virtual bool isValid() const
BlockInsert
BlockInsert
Commands for the vi insert mode.
Definition: kateviinsertmode.h:38
KateViModeBase::getCharAtVirtualColumn
const QChar getCharAtVirtualColumn(QString &line, int virtualColumn, int tabWidht) const
Definition: katevimodebase.cpp:1292
KateView::backspace
void backspace()
Definition: kateview.cpp:2546
KateViModeBase::doc
KateDocument * doc() const
Definition: katevimodebase.h:172
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
katecompletiontree.h
KateDocument::lineLength
virtual int lineLength(int line) const
Definition: katedocument.cpp:758
KateViInsertMode::commandInsertContentOfRegister
bool commandInsertContentOfRegister()
Definition: kateviinsertmode.cpp:239
KateCompletionWidget::cursorDown
void cursorDown()
Definition: katecompletionwidget.cpp:1063
KateViModeBase
Definition: katevimodebase.h:64
KateViInsertMode::commandNewLine
bool commandNewLine()
Definition: kateviinsertmode.cpp:136
KateViInputModeManager
Definition: kateviinputmodemanager.h:68
KateViInsertMode::commandCompleteNext
bool commandCompleteNext()
Definition: kateviinsertmode.cpp:204
NormalMode
Definition: kateviinputmodemanager.h:49
QString
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
KateViRange::startColumn
int startColumn
Definition: katevirange.h:41
KateView::home
void home()
Definition: kateview.cpp:2640
KateViInsertMode::m_textInsertedByCompletionEndPos
Cursor m_textInsertedByCompletionEndPos
Definition: kateviinsertmode.h:95
KateDocument::indent
void indent(KTextEditor::Range range, int change)
Definition: katedocument.cpp:2898
KateViInsertMode::commandInsertFromAbove
bool commandInsertFromAbove()
Definition: kateviinsertmode.cpp:58
KateViInsertMode::m_keys
QString m_keys
Definition: kateviinsertmode.h:88
KateViInsertMode::commandDeleteWord
bool commandDeleteWord()
Definition: kateviinsertmode.cpp:96
KateViInputModeManager::Completion::completedText
QString completedText() const
Definition: kateviinputmodemanager.cpp:909
AppendEOL
Definition: kateviinsertmode.h:42
kateviinputmodemanager.h
KateViInsertMode::~KateViInsertMode
~KateViInsertMode()
Definition: kateviinsertmode.cpp:53
KateViInsertMode::setBlockPrependMode
void setBlockPrependMode(KateViRange blockRange)
Definition: kateviinsertmode.cpp:550
KateView::completionWidget
KateCompletionWidget * completionWidget() const
Definition: kateview.cpp:2321
KateDocument::insertText
virtual bool insertText(const KTextEditor::Cursor &position, const QString &s, bool block=false)
Definition: katedocument.cpp:530
KateViInsertMode::commandIndent
bool commandIndent()
Definition: kateviinsertmode.cpp:142
KateViInsertMode::commandCompletePrevious
bool commandCompletePrevious()
Definition: kateviinsertmode.cpp:221
KateViInsertMode::commandMoveOneWordLeft
bool commandMoveOneWordLeft()
Definition: kateviinsertmode.cpp:181
KateViModeBase::m_view
KateView * m_view
Definition: katevimodebase.h:172
KateView::up
void up()
Definition: kateview.cpp:2660
KateViInputModeManager::Completion::completionType
CompletionType completionType() const
Definition: kateviinputmodemanager.cpp:917
KateView::keyDelete
void keyDelete()
Definition: kateview.cpp:2561
KateViInsertMode::commandInsertFromBelow
bool commandInsertFromBelow()
Definition: kateviinsertmode.cpp:77
KateDocument::character
virtual QChar character(const KTextEditor::Cursor &position) const
Definition: katedocument.cpp:388
KateViInsertMode::commandUnindent
bool commandUnindent()
Definition: kateviinsertmode.cpp:149
KateViRange
Definition: katevirange.h:33
KateViRange::endColumn
int endColumn
Definition: katevirange.h:44
KateViModeBase::startNormalMode
bool startNormalMode()
Definition: katevimodebase.cpp:1176
KTextEditor::Document
KateViInputModeManager::Completion::PlainText
Definition: kateviinputmodemanager.h:178
KateViInsertMode::commandSwitchToNormalModeForJustOneCommand
bool commandSwitchToNormalModeForJustOneCommand()
Definition: kateviinsertmode.cpp:273
kateglobal.h
KateCompletionWidget::bottom
void bottom()
Definition: katecompletionwidget.cpp:1136
KateViewInternal
Definition: kateviewinternal.h:57
KateViInsertMode::m_blockRange
KateViRange m_blockRange
Definition: kateviinsertmode.h:85
KateViModeBase::updateCursor
void updateCursor(const Cursor &c) const
Definition: katevimodebase.cpp:937
KateViInputModeManager::getMarkPosition
KTextEditor::Cursor getMarkPosition(const QChar &mark) const
Definition: kateviinputmodemanager.cpp:769
KateDocument::lines
virtual int lines() const
Definition: katedocument.cpp:753
KateCompletionWidget::top
void top()
Definition: katecompletionwidget.cpp:1123
KateCompletionWidget::cursorUp
void cursorUp()
Definition: katecompletionwidget.cpp:1078
KateDocument::documentEnd
virtual KTextEditor::Cursor documentEnd() const
Definition: katedocument.cpp:4682
katecompletionwidget.h
kateviewinternal.h
KateViInputModeManager::Completion::removeTail
bool removeTail() const
Definition: kateviinputmodemanager.cpp:913
KateDocument::newLine
void newLine(KateView *view)
Definition: katedocument.cpp:2659
KateViInsertMode::m_count
unsigned int m_count
Definition: kateviinsertmode.h:90
kateviinsertmode.h
KateViModeBase::getLine
const QString getLine(int lineNumber=-1) const
Definition: katevimodebase.cpp:119
KateViInsertMode::m_countedRepeatsBeginOnNewLine
bool m_countedRepeatsBeginOnNewLine
Definition: kateviinsertmode.h:91
KateViInsertMode::commandToFirstCharacterInFile
bool commandToFirstCharacterInFile()
Definition: kateviinsertmode.cpp:156
Prepend
Definition: kateviinsertmode.h:40
KateView
Definition: kateview.h:78
KateViModeBase::getCount
unsigned int getCount() const
Definition: katevimodebase.h:131
KTextEditor::Range
KTextEditor::Document::text
virtual QString text() const =0
KateViModeBase::findNextWordStart
Cursor findNextWordStart(int fromLine, int fromColumn, bool onlyCurrentLine=false) const
Definition: katevimodebase.cpp:317
KateViInsertMode::m_textInsertedByCompletion
QString m_textInsertedByCompletion
Definition: kateviinsertmode.h:94
LineWise
Definition: katevimodebase.h:51
KateView::cursorRight
void cursorRight()
Definition: kateview.cpp:2592
KateViModeBase::error
void error(const QString &errorMsg)
Definition: katevimodebase.cpp:1255
KateViInsertMode::m_eolPos
unsigned int m_eolPos
Definition: kateviinsertmode.h:84
KateViInputModeManager::Completion::CompletionType
CompletionType
Definition: kateviinputmodemanager.h:178
KateView::cursorLeft
void cursorLeft()
Definition: kateview.cpp:2576
KateViInputModeManager::Completion
Definition: kateviinputmodemanager.h:175
KateView::down
void down()
Definition: kateview.cpp:2670
KateViInsertMode::m_blockInsert
BlockInsert m_blockInsert
Definition: kateviinsertmode.h:80
katevikeyparser.h
KateViInsertMode::commandDeleteCharBackward
bool commandDeleteCharBackward()
Definition: kateviinsertmode.cpp:117
KateView::pageUp
void pageUp()
Definition: kateview.cpp:2710
KateView::cursorPosition
KTextEditor::Cursor cursorPosition() const
Definition: kateview.cpp:2398
Append
Definition: kateviinsertmode.h:41
ViMotion::ExclusiveMotion
Definition: katevirange.h:29
KTextEditor::Cursor::line
virtual int line() const
KateCompletionWidget::isCompletionActive
bool isCompletionActive() const
Definition: katecompletionwidget.cpp:746
KateViInsertMode::commandMoveOneWordRight
bool commandMoveOneWordRight()
Definition: kateviinsertmode.cpp:190
KateViInsertMode::commandToLastCharacterInFile
bool commandToLastCharacterInFile()
Definition: kateviinsertmode.cpp:168
KateViInsertMode::completionFinished
void completionFinished()
Definition: kateviinsertmode.cpp:575
KateViModeBase::getChosenRegister
QChar getChosenRegister(const QChar &defaultReg) const
Definition: katevimodebase.cpp:945
KTextEditor::Cursor::setLine
virtual void setLine(int line)
KateViInputModeManager::isReplayingMacro
bool isReplayingMacro()
Definition: kateviinputmodemanager.cpp:368
KateViInsertMode::m_isExecutingCompletion
bool m_isExecutingCompletion
Definition: kateviinsertmode.h:93
KateViInsertMode::findNextMergeableBracketPos
int findNextMergeableBracketPos(const Cursor &startPos)
Definition: kateviinsertmode.cpp:678
KateViModeBase::deleteRange
bool deleteRange(KateViRange &r, OperationMode mode=LineWise, bool addToRegister=true)
Definition: katevimodebase.cpp:61
KTextEditor::Range::end
Cursor & end()
KateViModeBase::m_viInputModeManager
KateViInputModeManager * m_viInputModeManager
Definition: katevimodebase.h:177
OperationMode
OperationMode
Definition: katevimodebase.h:49
KateViInputModeManager::isReplayingLastChange
bool isReplayingLastChange() const
Definition: kateviinputmodemanager.h:153
KateViInputModeManager::logCompletionEvent
void logCompletionEvent(const Completion &completion)
Definition: kateviinputmodemanager.cpp:373
KateDocument::text
virtual QString text(const KTextEditor::Range &range, bool blockwise=false) const
Definition: katedocument.cpp:337
None
Definition: kateviinsertmode.h:39
KateViModeBase::getRegisterContent
QString getRegisterContent(const QChar &reg)
Definition: katevimodebase.cpp:952
KateView::virtualCursorColumn
int virtualCursorColumn() const
Return the virtual cursor column, each tab is expanded into the document's tabWidth characters...
Definition: kateview.cpp:1919
KateViInsertMode::leaveInsertMode
void leaveInsertMode(bool force=false)
Definition: kateviinsertmode.cpp:479
KateView::abortCompletion
virtual void abortCompletion()
Definition: kateview.cpp:2334
Block
Definition: katevimodebase.h:52
KateViInputModeManager::nextLoggedCompletion
Completion nextLoggedCompletion()
Definition: kateviinputmodemanager.cpp:387
KateCompletionWidget::treeView
KateCompletionTree * treeView() const
Definition: katecompletionwidget.cpp:921
KateDocumentConfig::tabWidth
int tabWidth() const
Definition: kateconfig.cpp:403
KateViModeBase::findPrevWordStart
Cursor findPrevWordStart(int fromLine, int fromColumn, bool onlyCurrentLine=false) const
Definition: katevimodebase.cpp:498
KateViKeyParser::self
static KateViKeyParser * self()
Definition: katevikeyparser.cpp:38
kateconfig.h
KTextEditor::Cursor::setColumn
virtual void setColumn(int column)
KTextEditor::Cursor::column
int column() const
KateViInputModeManager::setTemporaryNormalMode
void setTemporaryNormalMode(bool b)
Definition: kateviinputmodemanager.h:231
completion
const KShortcut & completion()
KateViInputModeManager::Completion::FunctionWithArgs
Definition: kateviinputmodemanager.h:178
KateViRange::startLine
int startLine
Definition: katevirange.h:41
KateViModeBase::m_viewInternal
KateViewInternal * m_viewInternal
Definition: katevimodebase.h:176
KateDocument::removeText
virtual bool removeText(const KTextEditor::Range &range, bool block=false)
Definition: katedocument.cpp:633
KateCompletionWidget::execute
void execute()
Definition: katecompletionwidget.cpp:795
KateViInputModeManager::Completion::FunctionWithoutArgs
Definition: kateviinputmodemanager.h:178
KateViInsertMode::KateViInsertMode
KateViInsertMode(KateViInputModeManager *viInputModeManager, KateView *view, KateViewInternal *viewInternal)
Definition: kateviinsertmode.cpp:35
KateView::pageDown
void pageDown()
Definition: kateview.cpp:2720
KateViewConfig::global
static KateViewConfig * global()
Definition: kateconfig.h:402
KateViInsertMode::setBlockAppendMode
void setBlockAppendMode(KateViRange blockRange, BlockInsert b)
Definition: kateviinsertmode.cpp:559
KateViModeBase::m_register
QChar m_register
Definition: katevimodebase.h:154
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