Skip to content

Bug: Note list doesn't scroll to keep edited note visible after re-sort #1910

@gjouret

Description

@gjouret

Bug

When editing a note, sortAndMove() re-sorts the note list and moves the note to its new position (e.g., top for modification date sort, or alphabetically for title sort), but the list does not scroll to follow the moved note. The note appears to vanish from the visible area of the list.

Steps to reproduce

  1. Open a folder with many notes (enough to scroll)
  2. Sort by modification date (ascending) or by title
  3. Select and edit a note that is currently visible in the middle of the list
  4. The note moves to the top (modification date) or to its new alphabetical position
  5. The list stays scrolled to the same position — the note is no longer visible

Expected: The note list should scroll to keep the edited note visible after re-sorting.

Root cause (from source code)

sortAndMove() in ViewController.swift (lines 1608-1619) calls moveRow() but never calls scrollRowToVisible():

public func sortAndMove(note: Note, project: Project? = nil) {
    guard let srcIndex = notesTableView.getIndex(for: note) else { return }
    let notes = notesTableView.getNoteList()
    let resorted = storage.sortNotes(noteList: notes)
    guard let dstIndex = resorted.firstIndex(of: note) else { return }

    if srcIndex != dstIndex {
        notesTableView.moveRow(at: srcIndex, to: dstIndex)
        notesTableView.setNoteList(notes: resorted)
        // Missing: notesTableView.scrollRowToVisible(dstIndex)
    }
}

Suggested fix

Add notesTableView.scrollRowToVisible(dstIndex) after the moveRow call. This API is already used elsewhere in the codebase (e.g., SidebarOutlineView.swift line 632, ViewController.swift line 1515).

Environment

  • FSNotes 7.1.1
  • macOS 15 Sequoia

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions