diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Makefile.am | 11 | ||||
| -rw-r--r-- | lib/color.tes | 10 | ||||
| -rw-r--r-- | lib/colors/contrast.tes | 39 | ||||
| -rw-r--r-- | lib/colors/solarized.tes | 2 | ||||
| -rw-r--r-- | lib/colors/terminal.tes | 1 | ||||
| -rw-r--r-- | lib/fnkeys.tes | 23 | ||||
| -rw-r--r-- | lib/getopt.tes | 52 | ||||
| -rw-r--r-- | lib/lexer.tes | 22 | ||||
| -rw-r--r-- | lib/lexers/bash.tes | 8 | ||||
| -rw-r--r-- | lib/lexers/batch.tes | 3 | ||||
| -rw-r--r-- | lib/lexers/email.tes | 19 | ||||
| -rw-r--r-- | lib/lexers/git.tes | 9 | ||||
| -rw-r--r-- | lib/lexers/latex.tes | 32 | ||||
| -rw-r--r-- | lib/lexers/make.tes | 3 | ||||
| -rw-r--r-- | lib/lexers/python.tes | 4 | ||||
| -rw-r--r-- | lib/lexers/sciteco.tes | bin | 697 -> 809 bytes | |||
| -rw-r--r-- | lib/lexers/woman.tes | 10 | ||||
| -rw-r--r-- | lib/lexers/yaml.tes | 5 | ||||
| -rw-r--r-- | lib/opener.tes | 34 | ||||
| -rwxr-xr-x | lib/repl.tes | 55 | ||||
| -rw-r--r-- | lib/session.tes | bin | 3180 -> 3180 bytes | |||
| -rwxr-xr-x | lib/tecat.tes | 22 |
22 files changed, 307 insertions, 57 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am index b8832ab..0da616a 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,7 +1,12 @@ - dist_scitecolib_DATA = color.tes lexer.tes session.tes opener.tes \ fnkeys.tes string.tes getopt.tes +# Standalone scripts. +# These are not installed via _SCRIPTS as it would add the --program-prefix. +# Since they won't get the executable flag, it makes no sense to fix up their +# hash-bang lines as well. +dist_scitecolib_DATA += repl.tes tecat.tes + # Helper script for creating lexer definitions EXTRA_DIST = scite2co.lua @@ -9,6 +14,7 @@ EXTRA_DIST = scite2co.lua # a new color scheme: colorschemedir = $(scitecolibdir)/colors dist_colorscheme_DATA = colors/terminal.tes \ + colors/contrast.tes \ colors/solarized.tes lexerdir = $(scitecolibdir)/lexers @@ -105,6 +111,7 @@ dist_lexer_DATA += lexers/verilog.tes \ lexers/asciidoc.tes \ lexers/troff.tes \ lexers/sql.tes \ - lexers/css.tes + lexers/css.tes \ + lexers/latex.tes endif diff --git a/lib/color.tes b/lib/color.tes index f732848..a45c646 100644 --- a/lib/color.tes +++ b/lib/color.tes @@ -79,4 +79,14 @@ !* Set up brace lightning *! :M[color.bracelight],34M[color.set] :M[color.error],35M[color.set] + + !* Configure fold margin (except on the command line) *! + ED&2048"= + :M[color.linenumber]U.fU.b + Q.b,1ESSETFOLDMARGINCOLOUR Q.b,1ESSETFOLDMARGINHICOLOUR + 25U.x 7<Q.f,Q.xESMARKERSETFORE Q.b,Q.xESMARKERSETBACK %.x> + 10000++,25ESMARKERDEFINE 10000+-,26ESMARKERDEFINE + 10000++,30ESMARKERDEFINE 10000+-,31ESMARKERDEFINE + (2^*25 # 2^*26 # 2^*30 # 2^*31),2ESSETMARGINMASKN 0,2ESSETMARGINTYPEN + ' } diff --git a/lib/colors/contrast.tes b/lib/colors/contrast.tes new file mode 100644 index 0000000..256faad --- /dev/null +++ b/lib/colors/contrast.tes @@ -0,0 +1,39 @@ +!* + * High-contrast minimalist color scheme. + * This only highlights strings and comments (if supported by the terminal). + * This is also the recommended color scheme on monochrome displays. + *! +[color.default] 0,Q[color.black],Q[color.white] +[[color.default]][color.linenumber] +Q[color.black]U[color.caretline] +Q[color.lwhite]U[color.caretfore] +Q[color.black]U[color.selfore] +Q[color.white]U[color.selback] + +!* Also used for popups *! +[color.calltip] 0,Q[color.lwhite],Q[color.black] + +[color.comment] 2,Q[color.black],Q[color.white] +[[color.default]][color.number] +[[color.default]][color.keyword] +[color.string] 1,Q[color.black],Q[color.white] +[color.string2] 1,Q[color.black],Q[color.white] +[[color.default]][color.preproc] +[[color.default]][color.preproc2] +[[color.default]][color.operator] +[[color.default]][color.variable] +[[color.default]][color.error] + +!* Makes only sense for Makefiles *! +[[color.default]][color.target] + +!* Makes only sense for Patch/Diff files *! +[[color.default]][color.deletion] +[[color.default]][color.addition] +[[color.default]][color.change] + +!* For highlighting braces *! +[[color.default]][color.bracelight] + +!* Style the Q-Register view *! +[* EQ.b :M[color.init] ]* diff --git a/lib/colors/solarized.tes b/lib/colors/solarized.tes index fd0823e..11567d9 100644 --- a/lib/colors/solarized.tes +++ b/lib/colors/solarized.tes @@ -131,6 +131,8 @@ Q[solarized.light]"T :M[solarized.light] | :M[solarized.dark] ' [* EJ<%.bEB M[lexer.auto]> EQ.b :M[color.init] + !* FIXME: What if the user disabled it in .teco_ini? *! + :M[lexer.set.cmdline] ]* } diff --git a/lib/colors/terminal.tes b/lib/colors/terminal.tes index 2aa7354..ea048aa 100644 --- a/lib/colors/terminal.tes +++ b/lib/colors/terminal.tes @@ -6,6 +6,7 @@ Q[color.lwhite]U[color.caretfore] Q[color.black]U[color.selfore] Q[color.white]U[color.selback] +!* Also used for popups *! [color.calltip] 0,Q[color.lwhite],Q[color.black] [color.comment] 1,Q[color.black],Q[color.lblack] diff --git a/lib/fnkeys.tes b/lib/fnkeys.tes index 3fd0701..937caf9 100644 --- a/lib/fnkeys.tes +++ b/lib/fnkeys.tes @@ -117,6 +117,12 @@ 1U[CLOSE] !* + * F1 toggles __all__ folds. + *! +@[F1]{(2ESFOLDALL{-14D}} +1U[F1] + +!* * Zoom with F9/F10 if function keys are enabled. * This is automatically rubbed out. *! @@ -136,9 +142,26 @@ * Ctrl+right click: Insertion beginning of line * Scroll wheel: scrolls (faster with shift) * Ctrl+scroll wheel: zoom (GTK-only) + * + * Also, you can click on the folding margin to toggle folds. *! @[MOUSE]{ -2EJESCHARPOSITIONFROMPOINTU.p + + -2EJU.x ESGETMARGINLEFTU.r + ESGETMARGINS< + Q.rU.l Q.iESGETMARGINWIDTHN%.r + Q.x-Q.l+1"> Q.x-Q.r"< !* mouse within margin i *! + Q.iESGETMARGINMASKN&(-33554432)"N !* folding margin *! + -EJ-1"= !* mouse released *! + Q.pESLINEFROMPOSITIONESTOGGLEFOLD + {-9D} + ' + ' + 1; !* handle like click in text area *! + ' ' + %.i> + -4EJ&2"N Q.pESLINEFROMPOSITIONESPOSITIONFROMLINEU.p ' 1,Q.pESWORDSTARTPOSITION:U.#ws 1,Q.pESWORDENDPOSITION:U.#we diff --git a/lib/getopt.tes b/lib/getopt.tes index 46c813f..4ecfa3f 100644 --- a/lib/getopt.tes +++ b/lib/getopt.tes @@ -1,5 +1,5 @@ !*$ - * M[getopt] -> Success|Failure -- Parse options + * M[getopt] -> First non-flag argument -- Parse options * * Parses command line options according to the string * \(lqoptstring\(rq, similar to \fBgetopt\P(3). @@ -14,37 +14,47 @@ * If the option had an argument, it is stored in the register's * string part. * - * A condition boolean is returned to signify whether - * there was a parsing error. + * Returns the index of the first command-line argument that does not + * belong to a flag or -1 in case of parsing errors. *! [optstring] -@[getopt]{ [: - < - .-Z"= 1; ' 0A-^^-"N :L; F< ' +@[getopt]{ + <%.j + :Q[\.j]:; + 0Q[\.j]--"N 1; ' + !next! - 1A-^^-"= K 1; ' + 1Q[\.j]U.f + Q.f--"= !* -- *! Q.j+1 ' + !* j-th argument is -f *! 0U.i < - :Q[optstring]-Q.i"= ]: 0 ' - Q.iQ[optstring]U.c + Q.iQ[optstring]U.o Q.o"< -1 ' - 0U.#ar < - %.i-:Q[optstring]"= 1; ' - Q.iQ[optstring]-^^:"N 1; ' - %.#ar> + !* count number of : after o *! + 0U.#ar <%.iQ[optstring]-:"N 1; ' %.#ar> - 1A-Q.c"= - -U[getopt.U.c] + Q.f-Q.o"= + -U[getopt.U.o] Q.#ar"> - 2A-10"= - K Q.#ar-1"> 0A-^^-"= 0U.i F< ' ' + 2Q[\.j]"< + !* -f arg *! + %.j + Q.#ar-1"> !* optional arg *! + :Q[\.j]"< Q.j ' + 0Q[\.j]--"= Onext ' + | + :Q[\.j]"< -1 ' + ' + EU[getopt.U.o]Q[\.j] | - 2D + !* -farg *! + EU[getopt.U.o]Q[\.j] + [* EQ[getopt.U.o] 2D ]* ' - LR 0X[getopt.U.c] 0L ' - K 1; + 1; ' > > -]: -1} +Q.j} diff --git a/lib/lexer.tes b/lib/lexer.tes index 2676e1b..af6793a 100644 --- a/lib/lexer.tes +++ b/lib/lexer.tes @@ -5,12 +5,19 @@ [: 0,(1ESPOSITIONFROMLINE:)::S ]: } +!* + * The monospaced font for source code and + * figures in woman-pages. + *! +[lexer.font]Monospace +1200U[lexer.font] + @[lexer.auto]{ - - 0EJ-1"> :Q[lexer.font]"> + 0EJ-1"> 32ESSTYLESETFONTQ[lexer.font] Q[lexer.font],32ESSTYLESETSIZEFRACTIONAL - ' ' + ' :M[color.init] :Q*"= ' [_ @@ -22,7 +29,7 @@ [_ 1ENQ[$SCITECOPATH]/lexers/*.tes ]_ J <:L;R 0X.[filename] 4R .U.p <-A-^^/"= 1; ':R;> .,Q.pX.[name] - EMQ.[filename] + EIQ.[filename] :@EU[lexer.auto]{ :M[lexer.test.Q.[name]]"S :M[lexer.set.Q.[name]] ]_ ' } @@ -32,3 +39,12 @@ :@[lexer.auto]{ ]_ } + +@[lexer.set.cmdline]{ + 0,2048ED + :M[color.init] + !* indicator for rubbed out part of the command line *! + :M[color.default],8ESINDICSETFORE + :M[lexer.set.sciteco] + 2048,0ED +} diff --git a/lib/lexers/bash.tes b/lib/lexers/bash.tes index 862a0c1..893fc8d 100644 --- a/lib/lexers/bash.tes +++ b/lib/lexers/bash.tes @@ -35,10 +35,12 @@ :M[color.number],3M[color.set] :M[color.keyword],4M[color.set] :M[color.string],5M[color.set] - :M[color.string],6M[color.set] + :M[color.string2],6M[color.set] :M[color.operator],7M[color.set] - :M[color.target],8M[color.set] !* Identifiers, e.g. FOO=... *! + !!:M[color.target],8M[color.set] !* Identifiers, e.g. FOO=... *! :M[color.variable],9M[color.set] :M[color.variable],10M[color.set] - :M[color.string2],11M[color.set] !* Backticks *! + :M[color.preproc],11M[color.set] !* Backticks *! + :M[color.target],12M[color.set] !* Heredoc delimiter *! + :M[color.preproc2],13M[color.set] !* Heredoc *! } diff --git a/lib/lexers/batch.tes b/lib/lexers/batch.tes index dddd802..97717a1 100644 --- a/lib/lexers/batch.tes +++ b/lib/lexers/batch.tes @@ -17,7 +17,8 @@ :M[color.keyword],2M[color.set] :M[color.target],3M[color.set] !* Labels *! :M[color.preproc],4M[color.set] !* Hide Cmd @ *! - :M[color.preproc2],5M[color.set] !* External Cmd *! + !!:M[color.preproc2],5M[color.set] !* External Cmd *! :M[color.variable],6M[color.set] :M[color.operator],7M[color.set] + :M[color.preproc2],8M[color.set] !* After label *! } diff --git a/lib/lexers/email.tes b/lib/lexers/email.tes index 895aeea..11dbcf7 100644 --- a/lib/lexers/email.tes +++ b/lib/lexers/email.tes @@ -21,14 +21,25 @@ ZJ [_-:S^J-- ^J]_"S !* signatures *! 4R .U.z ESSTARTSTYLING 1,(:-)ESSETSTYLING + + !* the signature is foldable *! + ESLINEFROMPOSITIONU.l + 1024#(2^*13),Q.lESSETFOLDLEVEL + <:L; 1025,%.lESSETFOLDLEVEL> ' + 0U.l J< .-Q.z"= 1; ' - 0A->"= !* quotes *! - U.s - <:C; 0A- "N 1; '> .-Q.z"= 1; ' + U.s + 0U.q <0A->"N1;' %.q <:C; 0A- "N 1; '>> + + Q.q"> !* quotes *! Q.sESSTARTSTYLING - (0A->"=3|2'),(Q.lESLINELENGTH)ESSETSTYLING + (Q.q-1">3|2'),(Q.lESLINELENGTH)ESSETSTYLING + + !* first line with higher quote level: will be the header *! + (Q.l-1ESGETLINESTATE)-Q.q"< (1024+Q.q-1)#(2^*13) | (1024+Q.q) ',Q.lESSETFOLDLEVEL + Q.q,Q.lESSETLINESTATE ' :L; %.l> ]:} diff --git a/lib/lexers/git.tes b/lib/lexers/git.tes index 8495f12..491ec1e 100644 --- a/lib/lexers/git.tes +++ b/lib/lexers/git.tes @@ -18,6 +18,13 @@ :M[color.comment],1M[color.set] J< .-Z"= 1; ' - 0A-#"= ESSTARTSTYLING 1,(Q.lESLINELENGTH)ESSETSTYLING ' + 0A-#"= + ESSTARTSTYLING 1,(Q.lESLINELENGTH)ESSETSTYLING + + !* only the first line gets the fold level header *! + -2ESGETSTYLEINDEXAT-1"N 1024#(2^*13) | 1025 ',Q.lESSETFOLDLEVEL + ' + !* empty line *! + 0A-10"= 1024#(2^*12),Q.lESSETFOLDLEVEL ' :L; %.l> ]:} diff --git a/lib/lexers/latex.tes b/lib/lexers/latex.tes new file mode 100644 index 0000000..de3d1cf --- /dev/null +++ b/lib/lexers/latex.tes @@ -0,0 +1,32 @@ +!* LaTeX *! + +@[lexer.test.latex]{ + :EN*.texQ*"S -1 ' + :EN*.styQ* +} + +@[lexer.set.latex]{ + ESSETILEXERlatex + + !* command *! + :M[color.keyword],1M[color.set] + !* tag opening *! + :M[color.string],2M[color.set] + !* math inline *! + !!:M[color.preproc2],3M[color.set] + :M[color.comment],4M[color.set] + !* tag closing *! + :M[color.string],5M[color.set] + !* math block *! + !!:M[color.preproc2],6M[color.set] + :M[color.comment],7M[color.set] + !* verbatim segment *! + !!:M[color.string],8M[color.set] + !* short command *! + :M[color.preproc],9M[color.set] + !* special char *! + :M[color.preproc2],10M[color.set] + !* command optional argument *! + :M[color.string2],11M[color.set] + :M[color.error],12M[color.set] +} diff --git a/lib/lexers/make.tes b/lib/lexers/make.tes index 4ff519a..68acda1 100644 --- a/lib/lexers/make.tes +++ b/lib/lexers/make.tes @@ -3,6 +3,7 @@ @[lexer.test.make]{ :EN*/MakefileQ*"S -1 ' :EN*/makefileQ*"S -1 ' + :EN*/GNUmakefileQ*"S -1 ' :EN*.makQ* } @@ -13,5 +14,5 @@ :M[color.variable],3M[color.set] :M[color.operator],4M[color.set] :M[color.target],5M[color.set] - :M[color.error],6M[color.set] + :M[color.error],9M[color.set] } diff --git a/lib/lexers/python.tes b/lib/lexers/python.tes index f85f92b..6a46f1b 100644 --- a/lib/lexers/python.tes +++ b/lib/lexers/python.tes @@ -58,7 +58,9 @@ :M[color.string2],6M[color.set] :M[color.string],7M[color.set] :M[color.operator],10M[color.set] - :M[color.string],12M[color.set] + !!:M[color.variable],11M[color.set] + :M[color.comment],12M[color.set] + :M[color.error],13M[color.set] :M[color.string],16M[color.set] :M[color.string2],17M[color.set] :M[color.string2],18M[color.set] diff --git a/lib/lexers/sciteco.tes b/lib/lexers/sciteco.tes Binary files differindex 7ca9c70..0e7db64 100644 --- a/lib/lexers/sciteco.tes +++ b/lib/lexers/sciteco.tes diff --git a/lib/lexers/woman.tes b/lib/lexers/woman.tes index 86580f3..01b19d5 100644 --- a/lib/lexers/woman.tes +++ b/lib/lexers/woman.tes @@ -10,11 +10,17 @@ :EN*.womanQ* } +!* + * Font used for body text in woman pages. + * This can be a variable-width font. + *! +[lexer.woman.font]Serif + @[lexer.set.woman]{ 1ESSETWRAPMODE 1ESSETWRAPINDENTMODE 10,1#4ESSETYCARETPOLICY - 0EJ-1"> 32ESSTYLESETFONTSerif :M[color.init] ' + 0EJ-1"> 32ESSTYLESETFONTQ[lexer.woman.font] :M[color.init] ' - 1:EN*Q*.tec"S EMQ*.tec ' + 1:EN*Q*.tec"S EIQ*.tec ' } diff --git a/lib/lexers/yaml.tes b/lib/lexers/yaml.tes index 45104e7..2102afa 100644 --- a/lib/lexers/yaml.tes +++ b/lib/lexers/yaml.tes @@ -11,10 +11,13 @@ } @[lexer.set.yaml]{ + 2ESSETTABWIDTH + 0ESSETUSETABS + ESSETILEXERyaml 0ESSETKEYWORDStrue false yes no :M[color.comment],1M[color.set] - :M[color.target],2M[color.set] + :M[color.string],2M[color.set] :M[color.keyword],3M[color.set] :M[color.number],4M[color.set] :M[color.variable],5M[color.set] diff --git a/lib/opener.tes b/lib/opener.tes index 6de6237..c0183c8 100644 --- a/lib/opener.tes +++ b/lib/opener.tes @@ -1,38 +1,38 @@ !*$ - * M[opener] -- Open a number of files from the current buffer + * M[opener] -- Open files, specified on the command line * - * This is usually the unnamed buffer as initialized from the command line. * It supports both the +line[,column] and filename:line[:column] syntaxes. * Since this may make it hard to open files with certain file names, all * filenames after "--" are interpreted verbatim. + * It does not change the current buffer. *! -@[opener]{ - <.-Z; +@[opener]{ [* + <%.i :Q[\.i]:; EQ[\.i] !* --/-S stops processing of special arguments *! - 0A--"= 1A--"= 2A-10"= - L <:L;R 0X.f [* EBN.f ]* L> 1; + 0A--"= 1A--"= 2A"< + <%.i :Q[\.i]:; EBN[\.i]> 1; ''' 1U.l 1U.c !* +line[,column] *! - 0A-+"= - C 0A"D \U.l <0A"DC|1;'> 0A-,"= C \U.c ' 0A-10"=L' ' - ' + 0A-+"= C 0A"D + \U.l <0A"DC|1;'> 0A-,"= C \U.c <0A"DC|1;'> ' + 0A"< %.i Oopen ' + '' !* filename:line[:column][:] *! - LR -A-:"=R' + ZJ -A-:"=R' 0U.p <-%.pA"D|1;'> Q.pA-:"= Q.p+1C \U.a R 0U.p <-%.pA"D|1;'> Q.pA-:"= Q.p+1C \U.l Q.aU.c R | Q.aU.l 1U.c ' - | - LR + !* FIXME: modifies the i *! + .,ZD ' - 0X.f [* - EBN.f Q.c-1,Q.l-1ESFINDCOLUMN:J - ]* - L> -} + !open! + EBN[\.i] Q.c-1,Q.l-1ESFINDCOLUMN:J + > +]* } diff --git a/lib/repl.tes b/lib/repl.tes new file mode 100755 index 0000000..dbbf3ce --- /dev/null +++ b/lib/repl.tes @@ -0,0 +1,55 @@ +#!/usr/local/bin/sciteco -m +!* + * This is a stand-alone script that mimics + * classic TECO command lines. + * Requires an ANSI-compatible terminal. + * + * Currently, you must set the terminal characteristics on the outside: + * stty raw opost icrnl && sciteco -m /usr/local/share/sciteco/lib/repl.tes + * + * You can launch into interactive mode by typing -u#ex + * + * TODO: + * - Catch errors + * - Support *q + *! +0U#ex +< + * + < + U Q:; + !* erase current command line *! + [.c[.l + 0U.i 0U.l :Q<%.i-1Q-10"=%.l'> + Q.l"> [\.lF | 13 ' + [C[J + ].l].c + !* Handle rub out *! + Q-8"= 127U ' + Q-127"= + :Q"> + !* + * Remove last character from reg + * Doesn't require EQ which cannot be reliably undone. + *! + [.i 0U.i :Q-1<%.i-1Q:> ].i + ' + | + Q: + ' + !* Redraw command line *! + [.i[.c + 0U.i :Q< %.i-1QU.c + Q.c-10"= 10 F> ' + Q.c-"= $ F> ' + Q.c-32"< ^,(Q.c#64) | Q.c ' + > + ].c].i + !* FIXME: Catch errors *! + Q-"= + Q#">0U# 10 :M 1;' 1|0 + 'U# + > + ED&2"N1;' !* EX called *! + Q#ex:; +> diff --git a/lib/session.tes b/lib/session.tes Binary files differindex 3048e9e..845db25 100644 --- a/lib/session.tes +++ b/lib/session.tes diff --git a/lib/tecat.tes b/lib/tecat.tes new file mode 100755 index 0000000..5432997 --- /dev/null +++ b/lib/tecat.tes @@ -0,0 +1,22 @@ +#!/usr/local/bin/sciteco -8qm +!* + * Replace all control characters with printable representations as in SciTECO. + * These characters are printed in reverse using ANSI escape sequences. + * This is especially useful as a textconv filter for Git as in + * git config --global diff.teco.textconv "sciteco -8qm /usr/local/share/sciteco/lib/tecat.tes" + * + * You also have to add the following to ~/.gitattributes: + * *.teco_ini diff=teco + * .teco_session diff=teco + * *.tes diff=teco + * *.tec diff=teco + *! +0,2EJ !* FIXME: Memory limiting may be too slow *! +:Q#1"> EBN#1 ' +2 10011000000000Um + +<Q*-1"=|%i-1A'Uc Qc:; + Qc-31"> Qc F< ' Qm&(2^*Qc)"N Qc F< ' + [7m Qc-"=$|^,Qc#64' [27m +> +EX |
