madflow / flow-netbeans-markdown

Markdown file support for the NetBeans IDE
MIT License
277 stars 40 forks source link

outline not in document order #114

Closed jbuhacoff closed 7 years ago

jbuhacoff commented 8 years ago

Has anyone else noticed this? I have Netbeans 8.1

Let's say my document headings are (in order): A, A.1, A.2, B, B.1, B.2, C

In the Navigator, they might appear out of order, for example A, A.1, A.2, C, B, B.1, B.2

Seems that C would never get mixed in between A.1 and A.2, but among other headings at the same level they can be out of order.

Closing and reopening the document, quitting netbeans and restarting, seems to have no effect on this.

I have long markdown documents with a lot of headings, its quite troublesome to not find things in the outline where I expect them to be.

junichi11 commented 8 years ago

I cannot reproduce it. Can you write reproducible code here?

nb-markdown-issue114

stengerh commented 8 years ago

Same here. A minimal example which demonstrates this issue would be very useful.

jbuhacoff commented 8 years ago

Here is an example document:

`

Heading 1

Heading 1.1

Heading A

Heading B

Heading C

Heading D

Heading E

Heading F

Heading G

Heading H

Heading I

Heading J

Heading K

Heading L

Heading M

` image

junichi11 commented 8 years ago

@jbuhacoff Thanks! It's reproducible. Probably, @stengerh can fix it ;)

stengerh commented 8 years ago

Thank you for the example. The problem occurs whenever there are more than nine headings at the same level. The navigator view requires the plugin to provide a sort key as string. The generated sort keys look like "1.1.1", "1.1.10" or "1.1.2", and they are compared lexicographically. I will prepare a suitable fix.