Priority: Not Evaluated
Affects Version/s: None
Fix Version/s: None
Component/s: GUI: Text handling
When we parse something like
it's not easy to find out that "one dot one" is inside the first list: you can only see that it's indented further. (And which indent is most relevant BTW? We store several.) Assuming that the cursor is already on the "one dot one" line, I could just about solve it with code like this
except that the continuation paragraph is in the way, and it has also lost track of the fact that it "belongs to" the first list item.
I'm trying to implement interactive changing of list nesting (as part of a general indent/outdent feature in the richtext example).
If QTextList had a parentList() accessor, it would be a start towards solving this at least some of the time: if the cursor is on a list item, and I want to outdent it, I could check that the parent list is the one that the list item should be moved into (because it's already outdented).
But this would not solve how to indent the current list item. You might need a new list, or you might need to move it into a list below, one that is already indented. But now let's say the current list item also has a continuation paragraph: we would need to change its indent too, unless it already knows which list item it belongs to. So, perhaps QTextBlock needs a parentList() accessor.
Remembering syntactic structure is mainly relevant for HTML editing; but for markdown, it might be enough to just remember the indentation, and be able to rewrite the markdown on that basis.