summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcorvid <devnull@localhost>2013-01-09 14:04:59 +0100
committercorvid <devnull@localhost>2013-01-09 14:04:59 +0100
commitd236210c1608952b7910123fbede108317a80444 (patch)
treeb62f00a7725bc25a7c498a804cc5fa4177986f06
parente3ce71b187518f85a07211e0452de5aca543b0e5 (diff)
Reduced number of redraws when selecting text.
-rw-r--r--dw/textblock_iterator.cc11
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,