Works perfectly now. Thanks, Bert.
Also have some very nice feature after apply all the patches. That's great!
One missing patch is a correction for the cursor display. Maybe it is
originally from Thorsten Haude or Tony, which I am not sure now. However, the
difference is as follows:
cvs diff -u source/textDisp.c
Index: source/textDisp.c
===================================================================
RCS file: /cvsroot/nedit/nedit/source/textDisp.c,v
retrieving revision 1.71
diff -u -r1.71 textDisp.c
--- source/textDisp.c 4 Jan 2008 22:31:48 -0000 1.71
+++ source/textDisp.c 18 Sep 2008 20:36:40 -0000
@@ -1279,7 +1279,7 @@
int TextDMoveUp(textDisp *textD, int absolute)
{
- int lineStartPos, column, prevLineStartPos, newPos, visLineNum;
+ int lineStartPos, column, prevLineStartPos, newPos, visLineNum, offset = 1;
/* Find the position of the start of the line. Use the line starts array
if possible, to avoid unbounded line-counting in continuous wrap mode */
@@ -1300,13 +1300,24 @@
? textD->cursorPreferredCol
: BufCountDispChars(textD->buffer, lineStartPos, textD->cursorPos);
+ /* In continuous mode if the wrapping occurs at a non-whitespace
character,
+ the cursor is moved to the start of the next line, cf. TextDEndOfLine.
+ Therefore in this rare special case the previous line is two(!)
displayed
+ lines away. */
+ if (textD->continuousWrap) {
+ if (column > 0 && lineStartPos == textD->cursorPos) {
+ if (lineStartPos == TextDEndOfLine(textD, lineStartPos - 1, False))
+ offset = 2;
+ }
+ }
+
/* count forward from the start of the previous line to reach the column */
if (absolute) {
prevLineStartPos = BufCountBackwardNLines(textD->buffer, lineStartPos,
1);
- } else if (visLineNum != -1 && visLineNum != 0) {
- prevLineStartPos = textD->lineStarts[visLineNum-1];
+ } else if (visLineNum >= offset) {
+ prevLineStartPos = textD->lineStarts[visLineNum - offset];
} else {
- prevLineStartPos = TextDCountBackwardNLines(textD, lineStartPos, 1);
+ prevLineStartPos = TextDCountBackwardNLines(textD, lineStartPos,
offset);
}
newPos = BufCountForwardDispChars(textD->buffer, prevLineStartPos, column);
@@ -1324,7 +1335,7 @@
int TextDMoveDown(textDisp *textD, int absolute)
{
- int lineStartPos, column, nextLineStartPos, newPos, visLineNum;
+ int lineStartPos, column, nextLineStartPos, newPos, visLineNum, offset = 1;
if (textD->cursorPos == textD->buffer->length) {
return False;
@@ -1344,10 +1355,20 @@
? textD->cursorPreferredCol
: BufCountDispChars(textD->buffer, lineStartPos, textD->cursorPos);
+ /* In continuous mode if the wrapping occurs at a non-whitespace
character,
+ the cursor is moved to the start of the next line, cf. TextDEndOfLine.
+ Therefore in this rare special case we are already on the next line! */
+ if (textD->continuousWrap) {
+ if (column > 0 && lineStartPos == textD->cursorPos) {
+ if (lineStartPos == TextDEndOfLine(textD, lineStartPos - 1, False))
+ offset = 0;
+ }
+ }
+
if (absolute)
nextLineStartPos = BufCountForwardNLines(textD->buffer, lineStartPos,
1);
else
- nextLineStartPos = TextDCountForwardNLines(textD, lineStartPos, 1,
True);
+ nextLineStartPos = TextDCountForwardNLines(textD, lineStartPos,
offset, True);
newPos = BufCountForwardDispChars(textD->buffer, nextLineStartPos, column);
@@ -1611,7 +1632,7 @@
endDispPos = textD->continuousWrap ? wrapModEnd :
BufEndOfLine(buf, pos + nInserted) + 1;
if (origCursorPos >= startDispPos &&
- (origCursorPos <= endDispPos || endDispPos == buf->length))
+ (origCursorPos <= endDispPos || endDispPos >= buf->length))
blankCursorProtrusions(textD);
}
/* If more than one line is inserted/deleted, a line break may have
@@ -2996,7 +3017,7 @@
width = left - x;
} else if (cursorX >= right - cursorWidth/2 && cursorX <= right) {
x = right;
- width = cursorX + cursorWidth/2 + 2 - right;
+ width = cursorX + cursorWidth/2 + cursorWidth - right;
} else
return;
Thx again,
JF
--
NEdit Develop mailing list - [email protected]
http://www.nedit.org/mailman/listinfo/develop