Switch to distraction free mode messes up the cursor position

Bug report

When switching to/from distraction free mode, the cursor position in my note is messed up. It appears where it should not be, but when I actually type, the characters appear where they should. It’s just a visual glitch.

Potentially very useful observation
This seems to only happen on notes where there are lines that are long enough to force a WRAPPING of the text in the editor. I cannot reproduce this on a note where each line is short enough to fit in the editor without wrapping to the next line. However, if I type enough to make the line wrap, then this bug appears.

Here is a random note I created that reproduces the issue:

sadasdasda asdasdasd asdasd asdasdasd asdasd asdasdasd asdasd asdasdasd asdasd asdasdasd asdasd asdasdasd asdasd asdasdasd asdasd asdasdasd asdasd asdasdasd asdasd asdasdasd asdasd asdasdasd asdasd  asdasdasd asdasd


dsd

Leaving the cursor at the end of dsd at the end triggers the issue. When you switch to distraction free mode, the cursor appears on the next line after dsd, even though no content is there. Again note that the line must exceed the column width of the editor and wrap to the next line.

I do see this warning in the console, but may not be related:

DevTools failed to load SourceMap: Could not parse content for file:///C:/Users/<NAME>/AppData/Local/inkdrop/app-5.3.1/resources/app.asar/browser-exports.js.map: Unexpected end of JSON input

Info

  • Platform: Windows 10
  • Platform version: 20H2, OS build 19042.1083
  • App Version: 5.3.1

NOTE: This issue appears on my Ubuntu and Arch Linux systems as well.

Reproduce

Create a note and write a bunch of stuff into it. Then, switch to distraction free mode and note that the cursor position is not where you left it. Make sure that at least one line in the note exceeds the editor’s column width and wraps to the next line.

I have also seen this behavior where the cursor moves to another location and the characters appear in the expected location.

I’m running latest version, 5.3.1, on Arch Linux, Kernel 5.12.14

1 Like

Hi May and Nicole,

Thanks for the report. I could reproduce it.
That’s because CodeMirror has to know when the editor size gets changed.
I’ll fix it in the next release!

3 Likes