Kate
katevimodebase.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef KATE_VI_MODE_BASE_INCLUDED
00021 #define KATE_VI_MODE_BASE_INCLUDED
00022
00023 #include <ktexteditor/cursor.h>
00024 #include "kateview.h"
00025 #include "katevirange.h"
00026
00027 #include <QList>
00028
00029 class QKeyEvent;
00030 class QString;
00031 class QRegExp;
00032 class KateDocument;
00033 class KateViewInternal;
00034 class KateViVisualMode;
00035 class KateViNormalMode;
00036 class KateViInputModeManager;
00037
00038 class KateViModeBase
00039 {
00040 public:
00041 KateViModeBase() {};
00042 virtual ~KateViModeBase() {};
00043
00047 QString getVerbatimKeys() const;
00048
00049 protected:
00050
00051 bool deleteRange( KateViRange &r, bool linewise = true, bool addToRegister = true );
00052 const QString getRange( KateViRange &r, bool linewise = true ) const;
00053 const QString getLine( int lineNumber = -1 ) const;
00054 const QChar getCharUnderCursor() const;
00055 KTextEditor::Cursor findNextWordStart( int fromLine, int fromColumn, bool onlyCurrentLine = false ) const;
00056 KTextEditor::Cursor findNextWORDStart( int fromLine, int fromColumn, bool onlyCurrentLine = false ) const;
00057 KTextEditor::Cursor findPrevWordStart( int fromLine, int fromColumn, bool onlyCurrentLine = false ) const;
00058 KTextEditor::Cursor findPrevWORDStart( int fromLine, int fromColumn, bool onlyCurrentLine = false ) const;
00059 KTextEditor::Cursor findPrevWordEnd( int fromLine, int fromColumn, bool onlyCurrentLine = false ) const;
00060 KTextEditor::Cursor findPrevWORDEnd( int fromLine, int fromColumn, bool onlyCurrentLine = false ) const;
00061 KTextEditor::Cursor findWordEnd( int fromLine, int fromColumn, bool onlyCurrentLine = false ) const;
00062 KTextEditor::Cursor findWORDEnd( int fromLine, int fromColumn, bool onlyCurrentLine = false ) const;
00063 KateViRange findSurrounding( const QChar &c1, const QChar &c2, bool inner = false ) const;
00064 int findLineStartingWitchChar( const QChar &c, unsigned int count, bool forward = true ) const;
00065 void updateCursor( const KTextEditor::Cursor &c ) const;
00066
00067 KateViRange goLineUp();
00068 KateViRange goLineDown();
00069 KateViRange goLineUpDown( int lines);
00070
00071 unsigned int getCount() const { return ( m_count > 0 ) ? m_count : 1; }
00072
00073 bool startNormalMode();
00074 bool startInsertMode();
00075 bool startVisualMode();
00076 bool startVisualLineMode();
00077
00078 void error( const QString &errorMsg ) const;
00079 void message( const QString &msg ) const;
00080
00081 QChar getChosenRegister( const QChar &defaultReg ) const;
00082 QString getRegisterContent( const QChar ® ) const;
00083 void fillRegister( const QChar ®, const QString &text);
00084
00085 QChar m_register;
00086
00087 KateViRange m_commandRange;
00088 unsigned int m_count;
00089
00090 QString m_extraWordCharacters;
00091 QString m_keysVerbatim;
00092
00093 int m_stickyColumn;
00094
00095 inline KateDocument* doc() const { return m_view->doc(); };
00096 KateView *m_view;
00097 KateViewInternal *m_viewInternal;
00098 KateViInputModeManager* m_viInputModeManager;
00099 };
00100
00101 #endif