senf::term::BaseEditor Class Reference
Provide editor support terminal functionality.
More...
#include <senf/Utils/Termlib/Editor.hh>
List of all members.
Detailed Description
Provide editor support terminal functionality.
This base class utilizes an arbitrary AbstractTerminal and provides terminfo based terminal navigation and key parsing.
All navigation is relative to the current line. The display area can then be extended downwards up to a maximum of height() lines. Resetting this extended display area will return to a one line area containing only the top line.
All navigation is restricted to a width() x height() area. The last column may not be written to since auto-margin terminals will move the cursor to the next line when writing to that column.
This base class calls v_keyReceived() which must be defined in a derived class whenever a key is fully parsed.
Definition at line 60 of file Editor.hh.
|
Public Types
|
typedef KeyParser::keycode_t |
keycode_t |
Public Member Functions
|
|
BaseEditor (AbstractTerminal &terminal) |
void |
newline () |
|
Move to beginning of a new, empty line.
|
void |
toColumn (unsigned c) |
|
Move cursor to column c .
|
void |
put (char ch) |
|
Write ch at current column.
|
void |
put (std::string const &text) |
|
Write text starting at current column.
|
void |
clearLine () |
|
Clear current line and move cursor to first column.
|
void |
setBold () |
|
Set bold char display.
|
void |
setNormal () |
|
Set normal char display.
|
void |
maybeClrScr () |
|
Clear screen if possible.
|
void |
toLine (unsigned l) |
|
Move to relative display line l.
|
void |
reset () |
|
Reset display area to single line.
|
unsigned |
currentColumn () const |
|
Return number of current column.
|
unsigned |
currentLine () const |
|
Return number of current relative line.
|
unsigned |
width () const |
|
Return current screen width.
|
unsigned |
height () const |
|
Return current screen height.
|
Static Public Attributes
|
static unsigned const |
DEFAULT_KEY_TIMEOUT_MS = 500u |
Protected Member Functions
|
virtual bool |
cb_init () |
|
Called when terminal is initialized.
|
virtual void |
cb_windowSizeChanged () |
|
Called whenever the terminal window size changes.
|
virtual void |
v_keyReceived (keycode_t key)=0 |
|
Called whenever a key is received.
|
Member Typedef Documentation
Constructor & Destructor Documentation
Member Function Documentation
bool senf::term::BaseEditor:: |
cb_init |
() |
|
|
|
|
void senf::term::BaseEditor:: |
cb_windowSizeChanged |
() |
|
|
|
|
void senf::term::BaseEditor:: |
clearLine |
() |
|
|
|
|
Clear current line and move cursor to first column.
Definition at line 107 of file Editor.cc.
unsigned senf::term::BaseEditor:: |
currentColumn |
() |
|
|
|
|
Return number of current column.
Definition at line 187 of file Editor.cc.
unsigned senf::term::BaseEditor:: |
currentLine |
() |
|
|
|
|
Return number of current relative line.
Definition at line 193 of file Editor.cc.
unsigned senf::term::BaseEditor:: |
height |
() |
|
|
|
|
Return current screen height.
Definition at line 261 of file Editor.cc.
void senf::term::BaseEditor:: |
maybeClrScr |
() |
|
|
|
|
Clear screen if possible.
Definition at line 128 of file Editor.cc.
void senf::term::BaseEditor:: |
newline |
() |
|
|
|
|
Move to beginning of a new, empty line.
Definition at line 47 of file Editor.cc.
void senf::term::BaseEditor:: |
put |
( |
std::string const & |
text |
) |
|
Write text starting at current column.
Definition at line 95 of file Editor.cc.
void senf::term::BaseEditor:: |
put |
( |
char |
ch |
) |
|
Write ch
at current column.
Definition at line 87 of file Editor.cc.
void senf::term::BaseEditor:: |
reset |
() |
|
|
|
|
Reset display area to single line.
Definition at line 177 of file Editor.cc.
void senf::term::BaseEditor:: |
setBold |
() |
|
|
|
|
Set bold char display.
Definition at line 114 of file Editor.cc.
void senf::term::BaseEditor:: |
setNormal |
() |
|
|
|
|
Set normal char display.
Definition at line 121 of file Editor.cc.
void senf::term::BaseEditor:: |
toColumn |
( |
unsigned |
c |
) |
|
Move cursor to column c
.
Definition at line 55 of file Editor.cc.
void senf::term::BaseEditor:: |
toLine |
( |
unsigned |
l |
) |
|
Move to relative display line l.
Definition at line 134 of file Editor.cc.
virtual void senf::term::BaseEditor:: |
v_keyReceived |
( |
keycode_t |
key |
) |
|
Called whenever a key is received.
unsigned senf::term::BaseEditor:: |
width |
() |
|
|
|
|
Return current screen width.
Definition at line 255 of file Editor.cc.
Member Data Documentation
The documentation for this class was generated from the following files: