JX Application Framework
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
JVIKeyHandler Class Reference

#include <JVIKeyHandler.h>

Inheritance diagram for JVIKeyHandler:
[legend]

Classes

struct  CutBuffer
 

Public Types

enum  Mode {
  kTextEntryMode ,
  kCommandMode ,
  kCommandLineMode ,
  kBufferNameMode
}
 
enum  {
  kNamedCutBufferOffset = '0' ,
  kNamedCutBufferCount = 'z' - kNamedCutBufferOffset + 1
}
 

Public Member Functions

 JVIKeyHandler ()
 
 ~JVIKeyHandler () override
 
void Initialize (JTextEditor *te) override
 
bool HandleKeyPress (const JUtf8Character &key, const bool selectText, const JTextEditor::CaretMotion motion, const bool deleteToTabStop) override
 
- Public Member Functions inherited from JTEKeyHandler
 JTEKeyHandler ()
 
virtual ~JTEKeyHandler ()
 

Protected Member Functions

Mode GetMode () const
 
void SetMode (const Mode mode)
 
JSize GetOperationCount () const
 
bool GetPrevCharacter (JUtf8Character *c) const
 
const JStringGetCommandLine () const
 
void AppendToCommandLine (const JUtf8Character &key)
 
void ClearKeyBuffers ()
 
bool PrehandleKeyPress (const JUtf8Character &key, bool *result)
 
void YankLines (const JStringMatch &match, const bool del)
 
void YankToEndOfLine (const bool del, const bool ins)
 
CutBufferGetCutBuffer (const JRegex &r) const
 
CutBufferGetCutBuffer (const JRegex &r, const JStringMatch &match) const
 
bool IsEndCharacterInWord () const
 
- Protected Member Functions inherited from JTEKeyHandler
JTextEditorGetTE () const
 
void InsertKeyPress (const JUtf8Character &c)
 
void BackwardDelete (const bool deleteToTabStop, JString *text=nullptr)
 
void ForwardDelete (const bool deleteToTabStop, JString *text=nullptr)
 
void MoveCaretVert (const JInteger deltaLines)
 

Detailed Description

Implements vi keybindings.

TODO
dw   delete to end of word
db   delete to beginning of word
yw   yank to end of word
yb   yank to beginning of word

cc   change line -- delete line and start insert mode
s    change character -- delete character and start insert mode

md d'd  mark starting line, cut to ending line
my y'y  mark starting line, copy to ending line

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
kNamedCutBufferOffset 
kNamedCutBufferCount 

◆ Mode

Enumerator
kTextEntryMode 
kCommandMode 
kCommandLineMode 
kBufferNameMode 

Constructor & Destructor Documentation

◆ JVIKeyHandler()

JVIKeyHandler::JVIKeyHandler ( )

◆ ~JVIKeyHandler()

JVIKeyHandler::~JVIKeyHandler ( )
override

Member Function Documentation

◆ AppendToCommandLine()

void JVIKeyHandler::AppendToCommandLine ( const JUtf8Character key)
inlineprotected

◆ ClearKeyBuffers()

void JVIKeyHandler::ClearKeyBuffers ( )
inlineprotected

◆ GetCommandLine()

const JString & JVIKeyHandler::GetCommandLine ( ) const
inlineprotected

◆ GetCutBuffer() [1/2]

JVIKeyHandler::CutBuffer * JVIKeyHandler::GetCutBuffer ( const JRegex r) const
protected

◆ GetCutBuffer() [2/2]

JVIKeyHandler::CutBuffer * JVIKeyHandler::GetCutBuffer ( const JRegex r,
const JStringMatch match 
) const
protected

◆ GetMode()

JVIKeyHandler::Mode JVIKeyHandler::GetMode ( ) const
inlineprotected

◆ GetOperationCount()

JSize JVIKeyHandler::GetOperationCount ( ) const
protected

◆ GetPrevCharacter()

bool JVIKeyHandler::GetPrevCharacter ( JUtf8Character c) const
protected

◆ HandleKeyPress()

bool JVIKeyHandler::HandleKeyPress ( const JUtf8Character key,
const bool  selectText,
const JTextEditor::CaretMotion  motion,
const bool  deleteToTabStop 
)
overridevirtual

Implements JTEKeyHandler.

Reimplemented in JXVIKeyHandler.

◆ Initialize()

void JVIKeyHandler::Initialize ( JTextEditor te)
overridevirtual

This is necessary because the old key handler is deleted in JTextEditor::SetKeyHandler(), after the jnew one is constructed.

Reimplemented from JTEKeyHandler.

Reimplemented in JXVIKeyHandler.

◆ IsEndCharacterInWord()

bool JVIKeyHandler::IsEndCharacterInWord ( ) const
protected

◆ PrehandleKeyPress()

bool JVIKeyHandler::PrehandleKeyPress ( const JUtf8Character key,
bool result 
)
protected

◆ SetMode()

void JVIKeyHandler::SetMode ( const Mode  mode)
protected

◆ YankLines()

void JVIKeyHandler::YankLines ( const JStringMatch match,
const bool  del 
)
protected

◆ YankToEndOfLine()

void JVIKeyHandler::YankToEndOfLine ( const bool  del,
const bool  ins 
)
protected

The documentation for this class was generated from the following files: