Skip to content

Cursor position forgotten when computer sleeps (macOS) #1970

Description

@josh-nz

Description

When the computer sleeps, the currently active note forgets it's cursor position. When the computer wakes, and the note is edited again, the cursor is placed at the end of the note.

This is the bug report for my comment #1941 (comment)

To Reproduce

Make a new note.
Add the following content:

1
2
3
4
5
6

Place the cursor at the end of 3.
Sleep the computer
Wake the computer
Edit this note

Actual:
The cursor is now at the bottom of the note

Expected:
The cursor is at the end of 3.

This can "stack". For example, if you edit foo, sleep and wake, then edit bar, sleep and wake, both foo and bar will reset the cursor. It is however only the last edited note that prior to a sleep that forgets the cursor position. So to carry on this example, if you wake and then edit foo and set the cursor to non-end of note, then edit bar and set the cursor to non-end of note, sleep and wake, then only bar will reset cursor to end of note. The cursor when editing foo will be in the correct position.

It also doesn't matter when you edit the prior-to-sleep note, just that the next time you do so, the cursor will be at the end of the note. This behaviour can be seen in my "stack" example above, but there is another example: Edit foo, sleep and wake, edit bar (correct cursor position), edit foo (cursor at end of note).

I suspect this has the same root cause as whatever was causing the Quit/Load issue I reported here: #1941 (comment) So I suspect that whatever fix you made to remember the last edited note's cursor position on FSNotes quit will need to apply when any macOS sleep/hibernate event raised.

Expected behavior

Cursor position is remembered for the note that was edited prior to sleep, and restored correctly when that note is next edited.

FSNotes version

7.3.1 (715)

macOS/iOS version

15.7.7 macOS

Additional context

Related to #1941

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions