From cb1ef4788be0117f57497299ba008652f62cba24 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Thu, 1 May 2025 23:13:10 +0300 Subject: grosciteco: folding in woman pages * Support fold level configuration using `.SCITECO_FOLDLEVEL`. This sets the current output line as the fold header and all subsequent lines with the given fold level (until another `.SCITECO_FOLDLEVEL` instruction is encountered). * This is now done automatically for man's SH and SS macros, so the man-page based woman pages provide folding. * The folding margin is therefore now always enabled in fallback.teco_ini. --- doc/grosciteco.tes | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'doc/grosciteco.tes') diff --git a/doc/grosciteco.tes b/doc/grosciteco.tes index 9be0f1a..5548f1c 100755 --- a/doc/grosciteco.tes +++ b/doc/grosciteco.tes @@ -169,6 +169,12 @@ EBN[input] Q[stylestart]ESSTARTSTYLING Q.s,(-Q[stylestart])ESSETSTYLING ]* L F< + !cmd.xXsciteco_foldlevel! + C :M#giU.[foldlevel] + [* EB 0:M[move] + Q.[foldlevel],(ESLINEFROMPOSITION)ESSETLINESTATE + ]* + L F< !cmd.xXtty! !cmd.xXdevtag! L F< @@ -341,6 +347,30 @@ J 0U#cs 0U#cd QsU#cs .U#cd :C;> +!* + * The fold level is stored in the line state since it is set + * while the document is not fully built yet. + *! +J 0U#li 0U[cur.fl] 0U[last.line] +ESGETLINECOUNT< + Q#liESGETLINESTATEU#fl + Q#fl"N + Q[cur.fl]"N + Q#li-Q[last.line]Ux + 1024%[cur.fl] + @:EU[styles]{\[last.line]U.l \x<\[cur.fl],Q.lESSETFOLDLEVEL %.l>^J} + ' + Q#li+1U[last.line] Q#flU[cur.fl] + (1024+Q#fl-1)#(2^*13)U#fl + @:EU[styles]{\#fl,\#liESSETFOLDLEVEL^J} + ' +%#li> +Q[cur.fl]"N + Q#li-Q[last.line]Ux + 1024%[cur.fl] + @:EU[styles]{\[last.line]U.l \x<\[cur.fl],Q.lESSETFOLDLEVEL %.l>^J} +' + !* * Save the clear-text part of the document into *! -- cgit v1.2.3