Skip to content

The cursor is re-positioned to beginning after content is updatedΒ #773

Closed

Description

@stephen9357

Operating System and Version

Windows 11 22631.4037 x64

Distribution

NotepadNext-v0.11-win64.zip

Description

When NotepadNext window regains the focus, if the file content is updated, the cursor will be re-positioned to the beginning of the file instead of maintaining the previous position, which is a big disadvantage for analyzing log files.

Steps to Reproduce

  1. Open a log file while it's continuously writted to
  2. Click any other window to make NotepadNext window lose focus
  3. Click NotepadNext window to regain focus, make sure it automatic update the content, cursor is re-positioned to beginning

Debug Information

Notepad Next v0.11.0.0
Build Date/Time: Apr 2 2025 02:10:30
Qt: 6.5.3
OS: Windows 11 Version 23H2

Additional Details

e.g. screenshots, logs, etc

Activity

  1. changed the title [-]The cursor be re-positioned to beginning after content is updated[/-] [+]The cursor is re-positioned to beginning after content is updated[/+] on May 21, 2025
  2. noobyogi0010 commented on Jun 20, 2025

    @noobyogi0010

    Hello,
    I would like to take up this issue, if no one else has already taken it up.
    Thanks!

  3. dail8859 commented on Jun 20, 2025

    @dail8859
    Owner

    As far as I know nobody else is working on it.

    My best guess is this function

    void ScintillaNext::reload()
    {
    Q_ASSERT(isFile());
    // Ensure the file still exists.
    if (!QFile::exists(fileInfo.canonicalFilePath())) {
    return;
    }
    // Remove all the text
    {
    const QSignalBlocker blocker(this);
    setUndoCollection(false);
    emptyUndoBuffer();
    setText("");
    setUndoCollection(true);
    }
    // NOTE: if the read fails then the buffer will be completely empty...which probably
    // isn't a good thing, but this should be a rare occurrence.
    QFile f(fileInfo.canonicalFilePath());
    bool readSuccessful = readFromDisk(f);
    if (readSuccessful) {
    updateTimestamp();
    setSavePoint();
    }
    return;
    }
    would need modified to save the current selection (maybe also the view location) and then after the file is restored set the position and view.

  4. noobyogi0010 commented on Jun 23, 2025

    @noobyogi0010

    Cool, I'll give it a go this week.
    Okay, so I'll get the current position and the view, and store them temporarily and once the file has been restored I'll set the position and the view.
    Thank you!

  5. lucienlmy commented on Nov 9, 2025

    @lucienlmy

    Cool, I'll give it a go this week. Okay, so I'll get the current position and the view, ε’Œ store them temporarily and once the file has been restored I'll set the position and the view. Thank you!

    Is there any progress?

  6. added 2 commits that reference this issue on Feb 14, 2026
    9fb0957
    a3c09d4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions