edbee - Qt Editor Library
|
A delete command. This is a backspace or a delete operation. More...
#include <removecommand.h>
Public Types | |
enum | RemoveMode { RemoveChar, RemoveWord, RemoveLine } |
enum | Direction { Left, Right } |
Public Member Functions | |
RemoveCommand (int removeMode, int direction) | |
The remove command constructor. More... | |
int | coalesceId () const |
This method returns the coalesceId to use Currently all commands in the same direction will get the same coalesceId. More... | |
int | smartBackspace (TextDocument *doc, int caret) |
Performs a smart backspace by adjusting the textrange so the backspace leads to the start of a column. More... | |
void | rangesForRemoveChar (TextEditorController *controller, TextRangeSet *ranges) |
Changes the ranges so one character on the left is removed This method can switch to smart-backspace mode, so backspace moves to the previous column at the start of the line. More... | |
void | rangesForRemoveWord (TextEditorController *controller, TextRangeSet *ranges) |
Changes the ranges so one word at the left is removed. More... | |
void | rangesForRemoveLine (TextEditorController *controller, TextRangeSet *ranges) |
Changes the ranges so one line at the left is removed. More... | |
virtual void | execute (TextEditorController *controller) |
Performs the remove command. More... | |
virtual QString | toString () |
Converts the command to a string. More... | |
Public Member Functions inherited from edbee::TextEditorCommand | |
TextEditorCommand () | |
The default constructor. More... | |
virtual | ~TextEditorCommand () |
A blank virtual destructor. More... | |
A delete command. This is a backspace or a delete operation.
The delete behaviour is pretty obvious, it just deletes :)
The behaviour of the RemoveCharLeft depends on several factors:
When the editor has enabled useTabChar_is enabled, backspace is very simple, it simply deletes the previous character or the selection
When spaces are used for tabs the behaviour is different. If the caret is left of the first non-space character, it will move 1 column to the left, depending on the tabsize
edbee::RemoveCommand::RemoveCommand | ( | int | removeMode, |
int | direction | ||
) |
The remove command constructor.
removeMode | the mode for removal |
direction | the direction for the removal |
int edbee::RemoveCommand::coalesceId | ( | ) | const |
This method returns the coalesceId to use Currently all commands in the same direction will get the same coalesceId.
|
virtual |
Performs the remove command.
controller | the active controller |
Implements edbee::TextEditorCommand.
void edbee::RemoveCommand::rangesForRemoveChar | ( | TextEditorController * | controller, |
TextRangeSet * | ranges | ||
) |
Changes the ranges so one character on the left is removed This method can switch to smart-backspace mode, so backspace moves to the previous column at the start of the line.
controller | the active controller |
ranges | (in/out) the ranges to modify for deletion |
void edbee::RemoveCommand::rangesForRemoveLine | ( | TextEditorController * | controller, |
TextRangeSet * | ranges | ||
) |
Changes the ranges so one line at the left is removed.
controller | the active controller |
ranges | (in/out) the ranges to modify so it spans a line |
void edbee::RemoveCommand::rangesForRemoveWord | ( | TextEditorController * | controller, |
TextRangeSet * | ranges | ||
) |
Changes the ranges so one word at the left is removed.
controller | the active controller |
ranges | (in/out) the ranges to modify so it spans a word |
int edbee::RemoveCommand::smartBackspace | ( | TextDocument * | doc, |
int | caret | ||
) |
Performs a smart backspace by adjusting the textrange so the backspace leads to the start of a column.
controller | to perform the smartbackspace for |
caret | the current caret position |
|
virtual |
Converts the command to a string.
Implements edbee::TextEditorCommand.