Moving folded section messes up heading structure

Testing version: 0.1 (2936) on iPad 11 Pro, iPadOS 15.4.1

What were you doing: Moved an folded section up and down with extended keyboard: move up/down keys

What feature did you use: Move line up/down

What happened: Headings in other sections got moved to end with no text inside.

What did you expect to happen: Being able to move folded sections gracefully without messing up other sections.

Hello there,

I was not able to reproduce this, it would be really helpful if you can record the issue happening.

Thank you!

@matteo
Same issue on MacOS moving a folded section with ⌘⌥+Up or Down arrow.
I’ll do a screen recording on my iPad …

Hi again @matteo,

Here is a screen recording of the issue:
The other sections were not folded, and all headings got disconnected from their contents during the move :frowning:

Ah, I see :smiley:

Folding is dynamic in Panda, which means that’s not a fixed ranged of text. When you fold a header you fold everything until the next header that has the same level or less. In your example you’re moving an H2 after other H2s, making the text that was in their section part of the section you’re moving.

Let us make a visual example, this is the starting state:

## First (...)
## Second
More Text

Then you move ## First (...) after ## Second:

## Second
## First (... + More Text)

Now More Text is part of the ## First section and it’s moved inside the fold.

I understand what you’re trying to do (moving a section as a unit), but that’s not possible with the move row up/down when there is folding.

What you can do is select the whole section (without folding) and use the same command, which will only move the section and won’t include anything else.

We’re thinking about allowing drag’n drop in the ToC to allow easier section reordering :slight_smile:

Best.

Yes, but why do the headings get disconnected,

Pleas try it out in slow motion, it’s very messy and confusing as it is now.
Maybe block move function on folds, if not possible to move them as a unit.
What do you think?

This bug is even more serious than it seemed in the former video,
here is a new video showing that all text passed by the move is lost, only headings are left:

Sorry the text wasn’t completely lost, but was found inside other folded sections two levels deep. :upside_down_face: