1 Subject: textDrag.c: BlockDragSelection(): use cursorToHint to reduce redrawing
3 We have a way to optimize redrawing any cursor movement when we change the
4 text buffer. This patch apply it to the BlockDragSelection() function.
6 Actually this fixes a drawing bug with the Colored Cursorline (SF#683567)
7 patch. The cursor line is drawn above the selection while scrolling with the
8 selection down and leaves un-erased cursor lines behind.
12 source/textDrag.c | 20 +++++++++++++++-----
13 1 file changed, 15 insertions(+), 5 deletions(-)
15 diff --quilt old/source/textDrag.c new/source/textDrag.c
16 --- old/source/textDrag.c
17 +++ new/source/textDrag.c
18 @@ -363,8 +363,21 @@ void BlockDragSelection(TextWidget tw, i
19 repText = BufGetRange(tempBuf, modRangeStart - tempStart,
20 tempModRangeEnd - tempStart);
23 TextDBlankCursor(textD);
25 + /* set cursorToHint to new cursor position to optimize redrawing */
26 + if (rectangular || overlay) {
27 + insRectEnd = insRectStart + origSel->rectEnd - origSel->rectStart;
28 + textD->cursorToHint = BufCountForwardDispChars(buf,
29 + BufCountForwardNLines(buf, insStart, tw->text.dragNLines),
32 + textD->cursorToHint = insStart + origSel->end - origSel->start;
35 BufReplace(buf, modRangeStart, bufModRangeEnd, repText);
36 + textD->cursorToHint = NO_HINT;
39 /* Store the necessary information for undoing this step */
40 @@ -377,18 +390,15 @@ void BlockDragSelection(TextWidget tw, i
41 tw->text.dragSourceDeleted = sourceDeleted;
42 tw->text.dragType = dragType;
44 - /* Reset the selection and cursor position */
45 + /* Reset the selection */
46 if (rectangular || overlay) {
47 insRectEnd = insRectStart + origSel->rectEnd - origSel->rectStart;
48 BufRectSelect(buf, insStart, insStart + insertInserted, insRectStart,
50 - TextDSetInsertPosition(textD, BufCountForwardDispChars(buf,
51 - BufCountForwardNLines(buf, insStart, tw->text.dragNLines),
54 BufSelect(buf, insStart, insStart + origSel->end - origSel->start);
55 - TextDSetInsertPosition(textD, insStart + origSel->end - origSel->start);
58 TextDUnblankCursor(textD);
59 XtCallCallbacks((Widget)tw, textNcursorMovementCallback, (XtPointer)NULL);
60 tw->text.emTabsBeforeCursor = 0;