• 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
kateviinsertmode.h
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 #ifndef KATE_VI_INSERT_MODE_INCLUDED
24 #define KATE_VI_INSERT_MODE_INCLUDED
25 
26 #include <QKeyEvent>
27 #include "katevimodebase.h"
28 #include "katepartprivate_export.h"
29 
30 class KateViMotion;
31 class KateView;
32 class KateViewInternal;
33 
38 enum BlockInsert {
39  None,
40  Prepend,
41  Append,
42  AppendEOL
43 };
44 
45 class KATEPART_TESTS_EXPORT KateViInsertMode : public KateViModeBase
46 {
47  Q_OBJECT
48  public:
49  KateViInsertMode( KateViInputModeManager *viInputModeManager, KateView * view, KateViewInternal * viewInternal );
50  ~KateViInsertMode();
51 
52  bool handleKeypress( const QKeyEvent *e );
53 
54  bool commandInsertFromAbove();
55  bool commandInsertFromBelow();
56 
57  bool commandDeleteWord();
58  bool commandDeleteLine();
59  bool commandNewLine();
60  bool commandDeleteCharBackward();
61 
62  bool commandIndent();
63  bool commandUnindent();
64 
65  bool commandToFirstCharacterInFile();
66  bool commandToLastCharacterInFile();
67 
68  bool commandMoveOneWordLeft();
69  bool commandMoveOneWordRight();
70 
71  bool commandCompleteNext();
72  bool commandCompletePrevious();
73 
74  bool commandInsertContentOfRegister();
75  bool commandSwitchToNormalModeForJustOneCommand();
76 
77  void setBlockPrependMode( KateViRange blockRange );
78  void setBlockAppendMode( KateViRange blockRange, BlockInsert b );
79 
80  void setCount(int count) { m_count = count;};
81  void setCountedRepeatsBeginOnNewLine(bool countedRepeatsBeginOnNewLine) { m_countedRepeatsBeginOnNewLine = countedRepeatsBeginOnNewLine;};
82 
83  protected:
84  BlockInsert m_blockInsert;
85  unsigned int m_eolPos; // length of first line in eol mode before text is appended
86  KateViRange m_blockRange;
87 
88  QString m_registerTemp;
89  QString m_keys;
90 
91  unsigned int m_count;
92  bool m_countedRepeatsBeginOnNewLine;
93 
94  bool m_isExecutingCompletion;
95  QString m_textInsertedByCompletion;
96  Cursor m_textInsertedByCompletionEndPos;
97 
98  void leaveInsertMode( bool force = false);
99 
100  void completionFinished();
101  void replayCompletion();
102  int findNextMergeableBracketPos(const Cursor& startPos);
103  private slots:
104  void textInserted(KTextEditor::Document* document, KTextEditor::Range range);
105 };
106 
107 #endif
katevimodebase.h
BlockInsert
BlockInsert
Commands for the vi insert mode.
Definition: kateviinsertmode.h:38
KateViModeBase
Definition: katevimodebase.h:64
KateViInputModeManager
Definition: kateviinputmodemanager.h:68
KATEPART_TESTS_EXPORT
#define KATEPART_TESTS_EXPORT
Definition: katepartprivate_export.h:36
KateViInsertMode::m_textInsertedByCompletionEndPos
Cursor m_textInsertedByCompletionEndPos
Definition: kateviinsertmode.h:96
KateViInsertMode::m_keys
QString m_keys
Definition: kateviinsertmode.h:89
AppendEOL
Definition: kateviinsertmode.h:42
KateViModeBase::handleKeypress
virtual bool handleKeypress(const QKeyEvent *e)=0
KateViRange
Definition: katevirange.h:33
katepartprivate_export.h
KateViewInternal
Definition: kateviewinternal.h:58
KateViInsertMode::m_blockRange
KateViRange m_blockRange
Definition: kateviinsertmode.h:86
QString
KateViInsertMode::m_count
unsigned int m_count
Definition: kateviinsertmode.h:91
KateViInsertMode::m_countedRepeatsBeginOnNewLine
bool m_countedRepeatsBeginOnNewLine
Definition: kateviinsertmode.h:92
Prepend
Definition: kateviinsertmode.h:40
KateView
Definition: kateview.h:77
KateViInsertMode::m_textInsertedByCompletion
QString m_textInsertedByCompletion
Definition: kateviinsertmode.h:95
KateViInsertMode::m_eolPos
unsigned int m_eolPos
Definition: kateviinsertmode.h:85
KateViMotion
combined class for motions and text objects.
Definition: katevimotion.h:38
KateViInsertMode::m_registerTemp
QString m_registerTemp
Definition: kateviinsertmode.h:88
Append
Definition: kateviinsertmode.h:41
QKeyEvent
KateViInsertMode::m_isExecutingCompletion
bool m_isExecutingCompletion
Definition: kateviinsertmode.h:94
KateViInsertMode::setCountedRepeatsBeginOnNewLine
void setCountedRepeatsBeginOnNewLine(bool countedRepeatsBeginOnNewLine)
Definition: kateviinsertmode.h:81
None
Definition: kateviinsertmode.h:39
KateViInsertMode
Definition: kateviinsertmode.h:45
KateViInsertMode::setCount
void setCount(int count)
Definition: kateviinsertmode.h:80
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