Sublime Forum

Folding is not as dynamic as it could be

#1

Let’s say you have some text: (example1)

Section 1:
	A thing
	Another thing
Section 2:
	A third thing
	One more thing
	Even more one more thing

If you fold on Section 1 you see: (example2)

Section 1: ...]
Section 2:
	A third thing
	One more thing
	Even more one more thing

If you put your caret over Section 2: and move the line up (ctrl+shift+up) you see: (example3)

Section 1:...]Section 2:
	Another thing
	A third thing
	One more thing
	Even more one more thing

If we set this back to example2, and then move Section 2 down a line, we get this: (example4)

Section 1:...]
	One more thing
Section 2:
	Even more one more thing

In terms of what should happen, I imagine example3 should either have Section 2 on its own line, or it should unfold the entire section (because you are technically now editing something inside the scope of the fold.

With example 4, I imagine the correct thing would be to have ‘One more thing’ be encompassed by the fold when you move Section 2 past it.

0 Likes

Folding options?
#2

Confirm the above behaviour.

Folding is nearly (but not really) great in sublime. The behaviour when using line-up and line-down as the above post points out is spurious and certainly not reliable. With these wrinkles ironed out ST2 could easily replace the functionality of the Outliner in Word for example, about the only feature left in Word that I actually like :wink:

Other folding weirdness:

  1. selecting the folded line with Ctrl+l and cutting Ctrl+x, while selecting the fold, does not cut it. It only cuts the visible (parent) line of the fold, leaving the folded lines folded, the parent line empty and the fold mark still visible.
  2. selecting the folded line with Home then Shift+end DOES however correctly cut the entire fold, allowing it to be pasted elsewhere. In this case though it’d be much nicer to see the pasted section remain folded.

Finally, how can we define folding for particular language types like Markdown for example? It seems that Sublime ignores tmLanguage hints for folding, or am I wrong?

S

0 Likes

#3

Just wanted to note that I’d love if ST3 could handle this integration of folding and moving selections more robustly.

0 Likes