[TxMt] Folding Request - Count Pairs

Allan Odgaard throw-away-1 at macromates.com
Thu Oct 13 00:51:56 UTC 2005


On 12/10/2005, at 23.41, Sune Foldager wrote:

>> I propose that it should scan down and when it sees the second  
>> start fold marker at the same depth, add 1 to a counter; when it  
>> sees the first close fold marker at that depth, it checks the  
>> counter...since it is non-zero, it subtracts one. Finally, when it  
>> sees the last fold marker, and the counter is at zero, then it  
>> uses that as the correct, paired end fold.

It's conceptually done like that in latest build (I took a bit of  
freedom wrt the counter, since I already push/pop the markers on a  
stack ;) ).

> How about specifying folding markers in pairs? So it would only  
> match the correct start to the correct end.

Most languages only fold on { and }, or use a generic 'end' keyword  
to end different start blocks, so not much would be gained from this  
-- HTML comes to mind as one where there are different paired  
elements, but one could still have nested divs with same indent etc.




More information about the textmate mailing list