(svn r25683) -Add: Support for a marked/selected range to the textbuf.

This commit is contained in:
michi_cc
2013-08-05 20:37:22 +00:00
parent cbdfd31a3c
commit 64d2fc4d1e
4 changed files with 68 additions and 0 deletions

View File

@@ -40,6 +40,10 @@ struct Textbuf {
bool caret; ///< is the caret ("_") visible or not
uint16 caretpos; ///< the current position of the caret in the buffer, in bytes
uint16 caretxoffs; ///< the current position of the caret in pixels
uint16 markpos; ///< the start position of the marked area in the buffer, in bytes
uint16 markend; ///< the end position of the marked area in the buffer, in bytes
uint16 markxoffs; ///< the start position of the marked area in pixels
uint16 marklength; ///< the length of the marked area in pixels
explicit Textbuf(uint16 max_bytes, uint16 max_chars = UINT16_MAX);
~Textbuf();
@@ -62,6 +66,8 @@ struct Textbuf {
bool HandleCaret();
void UpdateSize();
void DiscardMarkedText(bool update = true);
private:
StringIterator *char_iter;
@@ -70,6 +76,7 @@ private:
void UpdateStringIter();
void UpdateWidth();
void UpdateCaretPosition();
void UpdateMarkedText();
};
#endif /* TEXTBUF_TYPE_H */