diff options
author | corvid <devnull@localhost> | 2013-01-09 14:04:59 +0100 |
---|---|---|
committer | corvid <devnull@localhost> | 2013-01-09 14:04:59 +0100 |
commit | d236210c1608952b7910123fbede108317a80444 (patch) | |
tree | b62f00a7725bc25a7c498a804cc5fa4177986f06 /dw/textblock_iterator.cc | |
parent | e3ce71b187518f85a07211e0452de5aca543b0e5 (diff) |
Reduced number of redraws when selecting text.
Diffstat (limited to 'dw/textblock_iterator.cc')
-rw-r--r-- | dw/textblock_iterator.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/dw/textblock_iterator.cc b/dw/textblock_iterator.cc index b5d28885..cfd27941 100644 --- a/dw/textblock_iterator.cc +++ b/dw/textblock_iterator.cc @@ -106,6 +106,11 @@ void Textblock::TextblockIterator::highlight (int start, int end, Textblock *textblock = (Textblock*)getWidget(); int index1 = index, index2 = index; + int oldStartIndex = textblock->hlStart[layer].index; + int oldStartChar = textblock->hlStart[layer].nChar; + int oldEndIndex = textblock->hlEnd[layer].index; + int oldEndChar = textblock->hlEnd[layer].nChar; + if (textblock->hlStart[layer].index > textblock->hlEnd[layer].index) { /* nothing is highlighted */ textblock->hlStart[layer].index = index; @@ -124,7 +129,11 @@ void Textblock::TextblockIterator::highlight (int start, int end, textblock->hlEnd[layer].nChar = end; } - textblock->queueDrawRange (index1, index2); + if (oldStartIndex != textblock->hlStart[layer].index || + oldStartChar != textblock->hlStart[layer].nChar || + oldEndIndex != textblock->hlEnd[layer].index || + oldEndChar != textblock->hlEnd[layer].nChar) + textblock->queueDrawRange (index1, index2); } void Textblock::TextblockIterator::unhighlight (int direction, |