Menu

#49 unexpected highlighting/selection

1.6
open
nobody
None
2026-03-17
2026-02-20
SweetTyler
No

It’s strange, but I suspect it may be related to the “File Modified” dialog that pops up.

Steps to reproduce (on Linux):

1) Compile the following C code and run the generated executable (for example, "printsomething"). Redirect the output to a file (for example, "aa") using command "printsomething > aa".

#include <stdio.h>
#include <unistd.h>
#include <time.h>

int main()
{
    struct timespec ts;
    ts.tv_sec = 0;
    ts.tv_nsec = 200000000;   // 200 million ns = 0.2 seconds

    for (int i = 0; i < 10000; i++) {
        printf("Loop iteration ...................................... %d\n", i);
        fflush(stdout);
        nanosleep(&ts, NULL);
    }
    return 0;
}

2) Open another terminal and launch xnedit to open the file "aa".

3) Click anywhere in the file and wait for the “File has been modified” dialog to appear. Click the “Reload” button, then scroll the mouse wheel slowly (not too slow).

You will very likely notice that while scrolling, some text becomes selected and highlighted as shown in the attached screenshot.

Discussion

  • SweetTyler

    SweetTyler - 2026-02-20

    Here is the snapshot.

     
  • SweetTyler

    SweetTyler - 2026-02-20

    My system is Fedora 43. Xnedit source code is the latest version downloaded from GitHub.

     
  • SweetTyler

    SweetTyler - 2026-03-17

    I forgot to mention that the following settings in nedit.rc are needed to reproduce the issue:

    nedit.warnFileMods: True
    nedit.warnRealFileMods: True

    I also found that if I set the second "resp" (lines 2561–2574 in file.c) to "1" directly, without calling DialogF(), the issue disappears in this test case.

        XUngrabPointer(XtDisplay(window->shell), timestamp);
        if (window->fileChanged)
            resp = DialogF(DF_WARN, window->shell, 2,
                    "File modified externally",
                    "%s has been modified by another program.  Reload?\n\n"
                    "WARNING: Reloading will discard changes made in this\n"
                    "editing session!", "Reload", "Cancel", window->filename);
        else
            resp = DialogF(DF_WARN, window->shell, 2,
                    "File modified externally",
                    "%s has been modified by another\nprogram.  Reload?",
                    "Reload", "Cancel", window->filename);
        if (resp == 1)
            RevertToSaved(window, NULL);
    

    Please let me know if you need more information or if I can help investigate further.

     

Log in to post a comment.

MongoDB Logo MongoDB