Closed ckjoris closed 2 years ago
Hello there! Thank you for the PR. Will this always stay within the same list as well? e.g. what happens when I have multiple lists separated only by whitespace? e.g.
- [ ] a1
- [ ] a1.1
- [ ] a1.1.1
- [ ] a1.1.2
- [ ] a1.2
- [ ] a1.2.1
- [ ] a1.2.2
- [ ] b1
- [ ] b1.1
- [ ] b1.1.1
- [ ] b1.1.2
- [ ] b1.2
- [ ] b1.2.1
- [ ] b1.2.2
It's been long since I worked on this part and I myself can't remember everything about the intricate inner workings of this anymore. It does seem however that I added an explicit check for indent != 0
which seems to be negated at least partially by your changes.
Hi & thanks for reviewing. I just retested it - yes it stays within the same list. Both if lists are separated by whitespace, or if not separated at all.
It works because the second part here if ((startc < lnum) || (indent != 0) || (startc == lnum && indent == 0))
is only true if cursor is on the checkbox with 0 indent. In the second list, startc
is not equal to lnum
.
Thank you for clarifying and going through the effort of creating a PR @ckjoris! I don't see any other potential issues so I'm going to merge it 👍 Your contribution is appreciated!
it was not possible to toggle checkbox state (of the whole tree) when cursor is on the topmost item (item 'a1' in example markdown)
this PR fixes that