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

Lines beginning with number are incorrectly identified as markdown numbered lists #1848

Closed
eoineoineoin opened this issue Jul 22, 2023 · 0 comments · Fixed by #1856
Closed
Labels

Comments

@eoineoineoin
Copy link

eoineoineoin commented Jul 22, 2023

Please use GitHub reactions 👍 to show that you are affected by the same issue. Please don't comment if you have no relevant information to add!

Describe the bug

When entering a line beginning with a number, the next line is pre-populated with a number in an unintuitive manner.

To Reproduce
Steps to reproduce the behavior:

  1. Open a note
  2. Start a line of text which begins with a number, but is not a markdown list, e.g. "340g honey"
  3. Type return to complete the line
  4. See the next line contains a markdown list

Expected behavior

Since the text I entered doesn't contain markdown syntax, I'd expect the new line to be blank. Right now, it's pre-populated with the markdown for the next number, so typing (where <CR> is the keyboard return/enter:

340g honey<CR>

becomes:

340g honey
341. 

This is even less intuitive if there isn't a non-numeric character in the first word:

340 honey<CR>

becomes:

340 honey
35.

It looks like the PATTERN_ORDERED_LIST_ITEM and PATTERN_ORDERED_LIST_ITEM_EMPTY in https://github.com/stefan-niedermann/nextcloud-commons/blob/master/markdown/src/main/java/it/niedermann/android/markdown/MarkdownUtil.java#L48 should be:

private static final Pattern PATTERN_ORDERED_LIST_ITEM = Pattern.compile("^(\\d+)\\.\\s.+$");
private static final Pattern PATTERN_ORDERED_LIST_ITEM_EMPTY = Pattern.compile("^(\\d+)\\.\\s$");

(note the escaped . character)

Screenshots

Smartphone (please complete the following information):

  • Nextcloud Notes-Version (android app): 4.1.0 RC1
  • F-Droid or Play Store: F-Droid
  • Android-Version: N/A
  • Device: N/A

Server

  • Nextcloud version: N/A
  • Nextcloud Notes version (server app): N/A

Stacktrace

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant