laurent22 / joplin

Joplin - the privacy-focused note taking app with sync capabilities for Windows, macOS, Linux, Android and iOS.

Home Page:https://joplinapp.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CodeMirror 6 quirk list

laurent22 opened this issue · comments

We would like the CodeMirror 6 editor to work like a regular text editor, with as few surprising or "smart" behaviours as possible. A good reference would be VSCode with default settings.

Indenting a list item moves the cursor to the end of the line

Fixed in: #10441

  • Create this list:
- one
- two

Ident the second item by moving the cursor before - two and press tab.

- one
    - two

Bug: The cursor moves to the end of the item like so - two|

Expected: The cursor should stay where it was, which would be before the dash: |-two

Editor wrongly guesses the number of newlines

  • Create a list with these items:
- one

- two
  • Move the cursor at the end of the first line: - one|
  • Press Enter
  • Bug: The editor inserts two newlines instead of one:
- one

-

- two
  • Expected: Pressing Enter once should enter one newline, never two or three.

Based on this commit ("preserve list tightness"), this seems to be an intentional upstream change. This doesn't happen in Joplin 2.14.20, so is a regression.

Here are a few options:

  • Downgrade @codemirror/lang-markdown to version 6.2.3.
  • Patch @codemirror/lang-markdown
  • Create a forum post upstream, asking them to revert the change, or make this an option.
  • Implement our own list continuation logic.

Edit: The behavior before v6.2.3 might also have some issues. See this forum post for details. The forum post author resolved the issue by writing their own list continuation logic.

Bug: The cursor moves to the end of the item like so - two|

Expected: The cursor should stay where it was, which would be before the dash: |-two

This should be resolved by #10441.