#587 cursor not erased completely

open
None
5
2007-05-27
2007-05-12
Anonymous
No

NEdit release of Aug 20, 2004

Built on: Linux, 386, Intel C++
Built at: May 12 2007, 15:22:08
With Motif: 2.2.3 [@(#)Motif Version 2.2.4]
Running Motif: 2.2 [unknown]
Server: Colin Harrison 60900023
Visual: 24-bit TrueColor (ID 0x22, Default)
Locale: en_US.iso885915

-------------------------------------------------

to repeat:

1) Run nedit;

2) In the opened window, keep typing some letters until they (exactly) reach the right boundary of the window.

3) Select some text from left to right, and make sure the last letter in this line is also included in the selection.

4) type the backspace and you'll find the cursor is not erased completely from its previous position.

This will be more clear if the cursor is set to heavy and the cursor blinking rate is set to zero.

Thank you.

Discussion

  • Logged In: NO

    to repeat, have to set line wrap to none.

     
  • Logged In: NO

    to repeat, have to set line wrap to none.

     
  • Logged In: NO

    !!??

     
  • Logged In: NO

    A fix: can any developer double check it and see if it can be improved?

    ======================================================================

    *** textDisp.c 2007-05-16 16:49:37.000000000 -0500
    --- textDisp.c.new 2007-05-23 16:09:11.000000000 -0500
    ***************
    *** 1620,1630 ****
    if (linesInserted == linesDeleted) {
    if (nInserted == 0 && nDeleted == 0)
    endDispPos = pos + nRestyled;
    else {
    endDispPos = textD->continuousWrap ? wrapModEnd :
    ! BufEndOfLine(buf, pos + nInserted) + 1;
    if (origCursorPos >= startDispPos &&
    (origCursorPos <= endDispPos || endDispPos == buf->length))
    blankCursorProtrusions(textD);
    }
    /* If more than one line is inserted/deleted, a line break may have
    --- 1620,1630 ----
    if (linesInserted == linesDeleted) {
    if (nInserted == 0 && nDeleted == 0)
    endDispPos = pos + nRestyled;
    else {
    endDispPos = textD->continuousWrap ? wrapModEnd :
    ! BufEndOfLine(buf, pos + nInserted + textD->fontStruct->min_bounds.width);
    if (origCursorPos >= startDispPos &&
    (origCursorPos <= endDispPos || endDispPos == buf->length))
    blankCursorProtrusions(textD);
    }
    /* If more than one line is inserted/deleted, a line break may have
    ***************
    *** 3001,3014 ****
    int cursorWidth, left = textD->left, right = left + textD->width;

    cursorWidth = (fontWidth/3) * 2;
    if (cursorX >= left-1 && cursorX <= left + cursorWidth/2 - 1) {
    x = cursorX - cursorWidth/2;
    ! width = left - x;
    } else if (cursorX >= right - cursorWidth/2 && cursorX <= right) {
    x = right;
    ! width = cursorX + cursorWidth/2 + 2 - right;
    } else
    return;

    XClearArea(XtDisplay(textD->w), XtWindow(textD->w), x, cursorY,
    width, fontHeight, False);
    --- 3001,3014 ----
    int cursorWidth, left = textD->left, right = left + textD->width;

    cursorWidth = (fontWidth/3) * 2;
    if (cursorX >= left-1 && cursorX <= left + cursorWidth/2 - 1) {
    x = cursorX - cursorWidth/2;
    ! width = left - x + fontWidth;
    } else if (cursorX >= right - cursorWidth/2 && cursorX <= right) {
    x = right;
    ! width = cursorX + cursorWidth/2 + fontWidth - right;
    } else
    return;

    XClearArea(XtDisplay(textD->w), XtWindow(textD->w), x, cursorY,
    width, fontHeight, False);
    ======================================================================

     
  • Logged In: NO

    last fix was wrong. The MORE correct one should be:

    ======================================================================

    *** textDisp.c 2007-05-16 16:49:37.000000000 -0500
    --- textDisp.c.new 2007-05-23 17:56:09.000000000 -0500
    ***************
    *** 1622,1632 ****
    endDispPos = pos + nRestyled;
    else {
    endDispPos = textD->continuousWrap ? wrapModEnd :
    BufEndOfLine(buf, pos + nInserted) + 1;
    if (origCursorPos >= startDispPos &&
    ! (origCursorPos <= endDispPos || endDispPos == buf->length))
    blankCursorProtrusions(textD);
    }
    /* If more than one line is inserted/deleted, a line break may have
    been inserted or removed in between, and the line numbers may
    have changed. If only one line is altered, line numbers cannot
    --- 1622,1632 ----
    endDispPos = pos + nRestyled;
    else {
    endDispPos = textD->continuousWrap ? wrapModEnd :
    BufEndOfLine(buf, pos + nInserted) + 1;
    if (origCursorPos >= startDispPos &&
    ! (origCursorPos <= endDispPos || endDispPos >= buf->length))
    blankCursorProtrusions(textD);
    }
    /* If more than one line is inserted/deleted, a line break may have
    been inserted or removed in between, and the line numbers may
    have changed. If only one line is altered, line numbers cannot
    ***************
    *** 3001,3014 ****
    int cursorWidth, left = textD->left, right = left + textD->width;

    cursorWidth = (fontWidth/3) * 2;
    if (cursorX >= left-1 && cursorX <= left + cursorWidth/2 - 1) {
    x = cursorX - cursorWidth/2;
    ! width = left - x;
    } else if (cursorX >= right - cursorWidth/2 && cursorX <= right) {
    x = right;
    ! width = cursorX + cursorWidth/2 + 2 - right;
    } else
    return;

    XClearArea(XtDisplay(textD->w), XtWindow(textD->w), x, cursorY,
    width, fontHeight, False);
    --- 3001,3014 ----
    int cursorWidth, left = textD->left, right = left + textD->width;

    cursorWidth = (fontWidth/3) * 2;
    if (cursorX >= left-1 && cursorX <= left + cursorWidth/2 - 1) {
    x = cursorX - cursorWidth/2;
    ! width = left - x + cursorWidth;
    } else if (cursorX >= right - cursorWidth/2 && cursorX <= right) {
    x = right;
    ! width = cursorX + cursorWidth/2 + cursorWidth - right;
    } else
    return;

    XClearArea(XtDisplay(textD->w), XtWindow(textD->w), x, cursorY,
    width, fontHeight, False);

    ======================================================================

     
  • Logged In: NO

    "width = left - x + cursorWidth;" is not necessary.

     
  • Thorsten Haude
    Thorsten Haude
    2007-05-27

    Logged In: YES
    user_id=119143
    Originator: NO

    patching file textDisp.c
    Hunk #1 FAILED at 1622.
    Hunk #2 FAILED at 3001.
    2 out of 2 hunks FAILED -- saving rejects to file textDisp.c.rej

    Any way you could provide a patch file?

     
  • Thorsten Haude
    Thorsten Haude
    2007-05-27

    Logged In: YES
    user_id=119143
    Originator: NO

    The patch seems to work, but I didn't test for regression. Please have a look.
    File Added: cursor-erase.2007-05-27.2.diff

     
  • Thorsten Haude
    Thorsten Haude
    2007-05-27

    • assigned_to: nobody --> yooden
     
  • Logged In: NO

    I think the patch is correct.
    BTW, the only concern for me is if "endDispPos > buf->length" can happen, and if it can, what's the impact of this patch in that situation.