Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile: Fixes #9477: Fix inline code at beginning of line in table breaks formatting #9478

Conversation

personalizedrefrigerator
Copy link
Collaborator

Summary

CodeMirror 6 requires decorations to be added in sorted order. First by the start position of a decoration, next by length.

Joplin's decorator extension was only sorting by start position. As such, in some cases, it could add decorations in an incorrect order.

This pull request fixes #9477 by sorting by length if start positions are equal.

Notes

The example given in #9477 is a regression from the previous version of the mobile app (2.12.3):

Some text with an `inline code block`.

x     | y
------|-----
`foo` | bar

Previously, the mobile editor didn't render tables in a monospace font. As such, it didn't attempt to add a decoration to table rows.

Full-line decorations have length 0. For the above table, Joplin adds the decorations to `foo` and to the table row in the wrong order. This throws an exception, causing no decorations to be added.

Testing

This pull request contains an automated test, but has been tested manually with the following steps:

  1. Enable the beta editor
  2. Paste the example from Joplin (Android) inline code block in table breaks formatting #9477 (see above)
  3. Verify that code blocks have borders.

@personalizedrefrigerator personalizedrefrigerator changed the base branch from dev to release-2.13 December 9, 2023 19:08
@laurent22 laurent22 merged commit 815a0a5 into laurent22:release-2.13 Dec 13, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Joplin (Android) inline code block in table breaks formatting
2 participants