3 source/textDrag.c | 20 +++++++++++++++-----
4 1 file changed, 15 insertions(+), 5 deletions(-)
6 diff --quilt old/source/textDrag.c new/source/textDrag.c
7 --- old/source/textDrag.c
8 +++ new/source/textDrag.c
9 @@ -361,12 +361,25 @@ void BlockDragSelection(TextWidget tw, i
11 /* Make the changes in the real buffer */
12 repText = BufGetRange(tempBuf, modRangeStart - tempStart,
13 tempModRangeEnd - tempStart);
16 TextDBlankCursor(textD);
18 + /* set cursorToHint to new cursor position to optimize redrawing */
19 + if (rectangular || overlay) {
20 + insRectEnd = insRectStart + origSel->rectEnd - origSel->rectStart;
21 + textD->cursorToHint = BufCountForwardDispChars(buf,
22 + BufCountForwardNLines(buf, insStart, tw->text.dragNLines),
25 + textD->cursorToHint = insStart + origSel->end - origSel->start;
28 BufReplace(buf, modRangeStart, bufModRangeEnd, repText);
29 + textD->cursorToHint = NO_HINT;
32 /* Store the necessary information for undoing this step */
33 tw->text.dragInsertPos = insStart;
34 tw->text.dragRectStart = insRectStart;
35 @@ -375,22 +388,19 @@ void BlockDragSelection(TextWidget tw, i
36 tw->text.dragSourceDeletePos = sourceDeletePos;
37 tw->text.dragSourceInserted = sourceInserted;
38 tw->text.dragSourceDeleted = sourceDeleted;
39 tw->text.dragType = dragType;
41 - /* Reset the selection and cursor position */
42 + /* Reset the selection */
43 if (rectangular || overlay) {
44 insRectEnd = insRectStart + origSel->rectEnd - origSel->rectStart;
45 BufRectSelect(buf, insStart, insStart + insertInserted, insRectStart,
47 - TextDSetInsertPosition(textD, BufCountForwardDispChars(buf,
48 - BufCountForwardNLines(buf, insStart, tw->text.dragNLines),
51 BufSelect(buf, insStart, insStart + origSel->end - origSel->start);
52 - TextDSetInsertPosition(textD, insStart + origSel->end - origSel->start);
55 TextDUnblankCursor(textD);
56 XtCallCallbacks((Widget)tw, textNcursorMovementCallback, (XtPointer)NULL);
57 tw->text.emTabsBeforeCursor = 0;