We have a way to optimize redrawing any cursor movement when we change the text
buffer. This patch apply it to the BlockDragSelection() function.
Actually this fixes a drawing bug with the Colored Cursorline (SF#683567) patch.
The cursor line is drawn above the selection while scrolling with the section
down and leaves un-erased cursor lines behind.
Regards
Bert
---
source/textDrag.c | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
diff --quilt old/source/textDrag.c new/source/textDrag.c
--- old/source/textDrag.c
+++ new/source/textDrag.c
@@ -361,12 +361,25 @@ void BlockDragSelection(TextWidget tw, i
/* Make the changes in the real buffer */
repText = BufGetRange(tempBuf, modRangeStart - tempStart,
tempModRangeEnd - tempStart);
BufFree(tempBuf);
+
TextDBlankCursor(textD);
+
+ /* set cursorToHint to new cursor position to optimize redrawing */
+ if (rectangular || overlay) {
+ insRectEnd = insRectStart + origSel->rectEnd - origSel->rectStart;
+ textD->cursorToHint = BufCountForwardDispChars(buf,
+ BufCountForwardNLines(buf, insStart, tw->text.dragNLines),
+ insRectEnd);
+ } else {
+ textD->cursorToHint = insStart + origSel->end - origSel->start;
+ }
+
BufReplace(buf, modRangeStart, bufModRangeEnd, repText);
+ textD->cursorToHint = NO_HINT;
XtFree(repText);
/* Store the necessary information for undoing this step */
tw->text.dragInsertPos = insStart;
tw->text.dragRectStart = insRectStart;
@@ -375,22 +388,19 @@ void BlockDragSelection(TextWidget tw, i
tw->text.dragSourceDeletePos = sourceDeletePos;
tw->text.dragSourceInserted = sourceInserted;
tw->text.dragSourceDeleted = sourceDeleted;
tw->text.dragType = dragType;
- /* Reset the selection and cursor position */
+ /* Reset the selection */
if (rectangular || overlay) {
insRectEnd = insRectStart + origSel->rectEnd - origSel->rectStart;
BufRectSelect(buf, insStart, insStart + insertInserted, insRectStart,
insRectEnd);
- TextDSetInsertPosition(textD, BufCountForwardDispChars(buf,
- BufCountForwardNLines(buf, insStart, tw->text.dragNLines),
- insRectEnd));
} else {
BufSelect(buf, insStart, insStart + origSel->end - origSel->start);
- TextDSetInsertPosition(textD, insStart + origSel->end - origSel->start);
}
+
TextDUnblankCursor(textD);
XtCallCallbacks((Widget)tw, textNcursorMovementCallback, (XtPointer)NULL);
tw->text.emTabsBeforeCursor = 0;
}
--
NEdit Develop mailing list - [email protected]
http://www.nedit.org/mailman/listinfo/develop