CVS rebase
[nedit-bw.git] / textDrag-use-cursorToHint.patch
blobfff1f7dd4105a97820ee28b51a10404d43083232
1 ---
3 source/textDrag.c | 20 +++++++++++++++-----
4 1 files 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);
14 BufFree(tempBuf);
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),
23 + insRectEnd);
24 + } else {
25 + textD->cursorToHint = insStart + origSel->end - origSel->start;
26 + }
28 BufReplace(buf, modRangeStart, bufModRangeEnd, repText);
29 + textD->cursorToHint = NO_HINT;
30 XtFree(repText);
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,
46 insRectEnd);
47 - TextDSetInsertPosition(textD, BufCountForwardDispChars(buf,
48 - BufCountForwardNLines(buf, insStart, tw->text.dragNLines),
49 - insRectEnd));
50 } else {
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;