aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2025-05-01 23:13:10 +0300
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2025-05-02 11:59:05 +0300
commitcb1ef4788be0117f57497299ba008652f62cba24 (patch)
treecbfd1ad93c12a7d4c1ba1041a50e1d62e6447837 /doc
parentd734f9904bbe0ba33dd86083e44d89cf2da3cbb2 (diff)
downloadsciteco-cb1ef4788be0117f57497299ba008652f62cba24.tar.gz
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.
Diffstat (limited to 'doc')
-rwxr-xr-xdoc/grosciteco.tes30
-rw-r--r--doc/sciteco.tmac23
-rw-r--r--doc/tutorial.ms.in11
3 files changed, 64 insertions, 0 deletions
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<
@@ -342,6 +348,30 @@ J 0U#cs 0U#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 <output-woman>
*!
2EL EWQ[output-woman]
diff --git a/doc/sciteco.tmac b/doc/sciteco.tmac
index 026e489..8e53407 100644
--- a/doc/sciteco.tmac
+++ b/doc/sciteco.tmac
@@ -66,6 +66,29 @@
. device sciteco_setstyling:\\$1
..
.
+.\" Set the fold level of the current line __and__ all following lines.
+.\" This could be called at the beginning of chapters and sections.
+.de SCITECO_FOLDLEVEL
+. device sciteco_foldlevel:\\$1
+..
+.
+.\" man-page specific extensions.
+.\" FIXME: Is there a reliable way to detect the man-page macros?
+.if dan \{\
+. rn SH SH-orig
+. de SH
+. SH-orig
+. SCITECO_FOLDLEVEL 1
+. nop \\$*
+. .
+. rn SS SS-orig
+. de SS
+. SS-orig
+. SCITECO_FOLDLEVEL 2
+. nop \\$*
+. .
+.\}
+.
.\"
.\" Effectively disable paragraph filling in man pages.
.\" Word wrapping will be performed by Scintilla.
diff --git a/doc/tutorial.ms.in b/doc/tutorial.ms.in
index acbf9ac..f246044 100644
--- a/doc/tutorial.ms.in
+++ b/doc/tutorial.ms.in
@@ -58,6 +58,7 @@ This tutorial guides you through the bare essentials of the editor.
Try the examples directly on this document.
.
.NH 2
+.SCITECO_FOLDLEVEL 1
Get me out of here!
.
.LP
@@ -73,6 +74,7 @@ In the remainder of this document, command examples are therefore formatted as f
.DE
.
.NH 2
+.SCITECO_FOLDLEVEL 1
Navigation
.
.LP
@@ -94,6 +96,7 @@ Using cursor movement or mouse buttons updates the movement
commands in the command line (the line at the bottom of the screen after \fB*\fP).
.
.NH 2
+.SCITECO_FOLDLEVEL 1
Insertion
.
.LP
@@ -115,6 +118,7 @@ There is no \(lqinsert\(rq mode, you are merely providing a string argument
to the interactively executed \fBI\fP command.
.
.NH 2
+.SCITECO_FOLDLEVEL 1
Deletion
.
.LP
@@ -130,6 +134,7 @@ Use the following command instead to discard all changes:
.DE
.
.NH 2
+.SCITECO_FOLDLEVEL 1
Saving
.
.LP
@@ -155,6 +160,7 @@ Remember, you can type CTRL+W to undo even the file write and restore the
previous state of the file.
.
.NH 2
+.SCITECO_FOLDLEVEL 1
Loading
.
.LP
@@ -184,6 +190,7 @@ in a typical UNIX shell!
Of course, you can press CTRL+W to revert opening the file.
.
.NH 2
+.SCITECO_FOLDLEVEL 1
Search and replace
.
.LP
@@ -210,6 +217,7 @@ so \fBS\fP\*$ repeats the last search and \fBFR\fP\*($$ repeats the last
search-replace operation.
.
.NH 2
+.SCITECO_FOLDLEVEL 1
Q-Registers
.
.LP
@@ -232,6 +240,7 @@ This however might not work out of the box if you are running the ncurses
version of \*(ST.
.
.NH 2
+.SCITECO_FOLDLEVEL 1
Programming
.
.LP
@@ -247,6 +256,7 @@ of performing a search-replace operation on the entire buffer:
.DE
.
.NH 2
+.SCITECO_FOLDLEVEL 1
Customize
.
.LP
@@ -271,6 +281,7 @@ $ @PACKAGE@ --no-profile
.DE
.
.NH 2
+.SCITECO_FOLDLEVEL 1
Further reading
.
.LP