aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
9 daysadded high-contrast color schemeRobin Haberkorn3-0/+41
* strings are bold (if supported) and bright white * comments are in italics (if supported by the terminal) * otherwise this uses the same colors as terminal.tes * should be well suited for monochrome terminals as well
2025-09-15fnkeys.tes: fixed clicking the fold marginRobin Haberkorn1-1/+1
This was broken by e82dc6639e829490cb11267fa4a49ef97c6459ae, i.e. wasn't broken in v2.4.0.
2025-08-13YAML lexer: default to 2 character soft tabsRobin Haberkorn1-0/+3
Hard tabs would even cause YAML syntax errors.
2025-08-08don't install the standalone scripts from lib/ as actual scripts: should fix ↵Robin Haberkorn3-17/+14
CI and nightlies * They would get the --program-prefix. * If they aren't installed as real scripts, there is no point in fixing up their hash-bang lines. * The hash-bang line fix won't work on Windows anyway, so they are now disabled for grosciteco and tedoc as well.
2025-08-07tecat.tes: optimized by using a binary mask instead of stringRobin Haberkorn1-0/+0
A 32-bit word is enough to carry the information of which control code to echo or not.
2025-08-07added tecat.tes to standard library: can be installed as the Git textconv filterRobin Haberkorn3-2/+14
tecat.tes and repl.tes are now executable scripts, even though they are installed into the $SCITECOPATH. This is still much slower than the Lua version here: https://gist.github.com/rhaberkorn/6534ecf1b05de6216d0a9c33f31ab5f8
2025-08-06command-line arguments are no longer passed via the unnamed buffer, but via ↵Robin Haberkorn2-37/+45
special Q-registers ^Ax * The unnamed buffer is also used for reading from --stdin, so you couldn't practically combine --stdin with passing command-line arguments to macros. * The old approach of passing command-line arguments via lines in the unnamed buffer was flawed anyway as it wouldn't work with filenames containing LF. This is just a very ancient feature, written when there weren't even long Q-reg names in SciTECO. * You can now e.g. pipe into SciTECO and edit what was read interactively, e.g. `dmesg | sciteco -i`. You can practically use SciTECO as a pager. * htbl.tes is now a command-line filter (uses -qio). * grosciteco.tes reads Troff intermediate code from stdin, so we no longer need "*.intermediate" temporary files. * added a getopt.tes test case to the testsuite. * This change unfortunately breaks most macros accepting command-line arguments, even if they used getopt.tes. It also requires updating ~/.teco_ini - see fallback.teco_ini.
2025-07-31repl.tes: added script that reproduces the classic TECO REPL command-lineRobin Haberkorn2-0/+57
* Unfortunately, this will currently just terminate when some command fails. We require an error catching mechanism to fix this up.
2025-06-03added LaTeX lexer configRobin Haberkorn2-1/+34
2025-05-24<EI> has been repurposed and is the macro file inclusion (indirect file) ↵Robin Haberkorn3-2/+2
command now * Improves DEC TECO-11 compatibility. * <EM> is still supported as a synonym, but considered deprecated and is no longer documented. A warning is printed when invoked. It can be repurposed at any time in the future. * `EI$` is not yet supported. I am unsure whether this makes any sense.
2025-05-16python lexer: fixed block comment stylingRobin Haberkorn1-1/+3
Also, unterminated strings are highlighted with the "error" color now.
2025-05-01implemented email and git lexer foldingRobin Haberkorn2-5/+23
2025-05-01folding: enable markers for sub-folds as wellRobin Haberkorn1-3/+4
2025-04-27opener.tes: Fixed +line,column syntaxRobin Haberkorn1-3/+5
* After detecting +line[,column] constructs, the next argument is not parsed as a potential filename:line[:column] construct. * This code turned out to be tricky to get right, so I added a test case. Standard library modules can well be checked in the test suite since we have $SCITECOPATH pointing to the source tree's lib/ directory. * Make sure that relevant variables from atlocal.in are really exported into the process environment. This was also broken for the Glib debug options.
2025-04-27support folding via F1 and clicks in the folding marginRobin Haberkorn2-0/+30
* Set up the folding margin in the currently empty margin column after the line number. On Gtk, this meant resetting all the marker symbols and their foreground/background colors as well as the margin's colors themselves. This looks like a bug. It's not necessary on Scinterm, which apparently uses the default/linenumber styles by default. Perhaps we should try upgrading Scintilla? * The folding state is considered not to be directly controlled by the language (just like the scroll position and zoom level). That's why we can directly control it by clicking on the margin column. * F1 can be used to toggle all folds globally. * The only support within the C core necessary for folding is to make sure that the current line is unfolded after every keypress. * We might add custom folding commands to the language later on (e.g. F+, F-). In this case, the key macros will have to be changed of course.
2025-04-23fixup: fixed monospace sections in womanpages when lexer.font is not ↵Robin Haberkorn1-2/+9
customized (refs #34) * In the grosciteco-generated .woman.tec files, the fonts were only set on the monospaced styles if lexer.font was set since it was undefined by default. We'd need a lare IF-ELSE statement to handle that in womanpages since woman.tes changes the default font to a variable-width font. Just leaving the default font, therefore won't work. * We now always initialize lexer.font in lexer.tes. You no longer have to check for its existance. * Consequently, you can no longer set lexer.font *before* munging lexer.tes because it will be overwritten. At least not without additional checks. Such a design is not suggested by fallback.teco_ini, though. * Fixes monospaced sections in the tutorial and other womanpages on Gtk.
2025-04-22Gtk: monospaced sections in womanpages now respect lexer.font and ↵Robin Haberkorn1-1/+7
variable-width font is configurable via lexer.woman.font (refs #34) * grosciteco was just hardcoding "Monospace", regardless of what was configured via lexer.font in ~/.teco_ini * The variable-width font used for ordinary "womanpage" body texts was hardcoded to "Serif". It is now configurable via the lexer.woman.font register. * There is a difference, though: lexer.font has no default value and must therefore be checked everywhere. This is so you can set it even before munging lexer.tes. lexer.woman.font however has a default (Serif), so it can only be overridden after munging lexer.tes. Perhaps it would be easier and more consistent to have a default for lexer.font as well.
2025-04-18scite2co: look up file patterns from filter.<lang> properties instead of ↵Robin Haberkorn1-1/+1
file.patterns The former is more basic and usually references file.patterns. This helped for instance with processing SciTE's css.properties.
2025-04-18added CSS lexer configurationRobin Haberkorn2-1/+76
Especially useful since Gtk users are supposed to edit ~/.teco_css.
2025-04-18Gtk/win32: fixed fonts and therefore pango warnings on startup (closes #7)Robin Haberkorn1-1/+1
* The default womanpage font is the abstract "Serif" now, so that should be more portable. "Times" wasn't found on Windows. * Win32 distributions include a custom .teco_css now, which removes the small-caps font attribute from the type label. The default Gtk theme on Windows references the "Segoe UI" font and it doesn't have a small-caps variant. In fact no default Windows font appears to have one. * We could add a custom .teco_ini to win32 distributions as well, but there is currently no need for it. * Do not distribute the /win32 files. They are used only for building Win32/64 packages. There is no point in distributing them in the tarball if the /debian and /freebsd directories aren't distributed as well.
2025-04-09fnkeys.tes: mouse scrolling scrolls 2 lines by default and left clicks ↵Robin Haberkorn1-3/+6
update the horizontal position (4EJ)
2025-04-09added SQL lexer configurationRobin Haberkorn2-1/+72
* Unfortunately, the Lexilla lexer does not recognize PostgreSQL multiline strings between $$...$$. * All of the other SQL variants, that Scite supports, are skipped for the time being. They'd probably have to be separate SciTECO lexer configs anyway.
2025-04-04scroll caret __almost__ always automatically after key pressesRobin Haberkorn1-2/+2
* The old heuristics - scroll if dot changes after key press - turned out to be too simplistic. They broke the clang-format macro (M#cf), which left the view at the top of the document since the entire document is temporarily erased. Other simplified examples of this bug would be: @^Um{[: HECcat$ ]:} Mm Or even: @^Um{[: H@X.aG.a ]:} Mm * Actually, the heuristics could be tricked even without deleting any significant amount of text from the buffer. The following test case replaces the previous character with a linefeed in a single key press: @^Um{-DI^J$} Mm If executed on the last visible line, dot wouldn't be scrolled into the view since it did not change. * At the same time, we'd like to keep the existing mouse scroll behavior from fnkeys.tes, which is allowed to scroll dot outside of the visible area. Therefore, dot is scrolled into view always, except after mouse events. You may have to call SCI_SCROLLCARET manually in the ^KMOUSE macro, which is arguably not always straight forward. * Some macros like M#cf may still leave the vertical scrolling position in unexpected positions. This could either be fixed by eradicating all remaining automatic scrolling from Scintilla or by explicitly restoring the vertical position from the macro (FIXME). * This was broken since the introduction of mouse support, so it wasn't in v2.3.0.
2025-04-03improved the "asm" (x86 assembly) lexerRobin Haberkorn1-1/+9
There are still some glitches with non-mainstream assemblers like A86, though.
2025-03-31the git, sciteco and email lexer configurations are now installed even ↵Robin Haberkorn1-5/+5
--without-lexilla They don't require Lexilla, so it makes no sense not to exclude them.
2025-03-31added tutorial document, which is automatically loaded on the first invocationRobin Haberkorn1-0/+0
* This is rendered with ms, so we now need the entire groff on Debian. This is not a big deal as it just adds a few kilobytes of build-time dependencies. Most platforms do not allow installation of some "groff-base" package anyway and always draw in the entire package. * sciteco.tmac has been extended to disable page breaks on ms. * The tutorial is installed like any other woman page and can be invoked interactively with ?tutorial$. * It is optimized to be still usable on a plain 80x24 terminal.
2025-03-31opener.tes: fixed opening filename:line if filename has trailing digitsRobin Haberkorn1-3/+4
The trailing digits where cut off the filename. E.g. when trying `sciteco test.f77:100`, we would open test.f on line 100 instead.
2025-03-23the ES command (send Scintilla message) now supports passing both wParam and ↵Robin Haberkorn4-0/+0
lParam as null-terminated strings * Being able to embed null bytes into the lParam string is practically useless - there aren't any messages where this is useful and where there are no native SciTECO counterparts - so this case is now catched and the null-byte separates wParam from lParam. * wParam can be the empty string, but it is not supported to pass wParam as a string and lParam as the empty string. If the second string argument ends in ^@, lParam is popped from the stack instead. * This is a temporary workaround until we can properly parse the Scintilla.iface and generate more elegant per-message wrappers. * It in particular unlocks the SCI_SETREPRESENTATION and SCI_SETPROPERTY messages. The former allows us to write a special hex-editor macro which sets hexadecimal character representations, while the latter allows you to set lexer properties. * The C-based lexers ("cpp" in Lexilla) can now take preprocessor definitions into account. This is disabled by default, unless you set lexer.c.defines before opening a file. You can also set it interactively and re-set the lexer. For instance: ^U[lexer.c.defines]NDEBUG$ M[lexer.set.c]
2025-03-22harmonized all word-movement and deletion commands: they move/delete until ↵Robin Haberkorn2-3/+3
the beginning of words now * All commands and their documentations were inconsistent. * ^W rubbed out to the beginning of words. * Shift+Right (fnkeys.tes) moved to the beginning of the next word if invoked at the beginning of a word and to the end of the next word otherwise. * <W> (and <V> and <Y> by extension) moved to the end of the next word. * The cheat sheet would claim that <W> moves to the beginning of the next word. * Video TECO's <W> command would differ again from everything else. With positive arguments, it moved to the beginning of words, while with negative it moved to end of words. I decided not to copy this behavior. * It has been decided to adopt a consistent beginning-of-words policy. -W therefore differs from Video TECO in moving to the beginning of the current or previous word. * teco_find_words() is now based on parsing the document pointer, instead of relying on SCI_WORDENDPOSITION, since the latter cannot actually be used to skip strictly non-word characters. This requires a constant amount of Scintilla messages but will require fewer messages only when moving for more than 3 words. * The semantics of <W> are therefore now consistent with Vim and Emacs as well. * Shift+Right/Left is still based on SCI_WORDENDPOSITION, so it's behavior differs slightly from <W> for instance at the end of lines, as it will stop at linebreaks. * Unfortunately, these changes will break lots of macros, among others the M#rf, M#sp and git.blame macros ("Useful macros" from the wiki).
2025-03-12sciteco lexer: enable 2-char soft tabs by defaultRobin Haberkorn1-0/+4
* You practically never want to indent in SciTECO code with hard tabs, as the hard tab is an insertion command. * 2-char soft tabs are the convention in SciTECO's included macros. * Fixes the M#it macro among other things. * If you do want to insert an insertion-with-tab command (ASCII 9), you almost always will want to type it ^I instead. Real ASCII 9s should consequently be highlighted, ie. there should be a character representation. Unfortunately, character representations are currently set in C code and cannot be changed via <ES>.
2025-03-08Asciidoc, Markdown and Git lexers: enable word wrapping by defaultRobin Haberkorn3-0/+6
These are all more or less plain text formats.
2025-03-08added "email" lexer for writing mailsRobin Haberkorn2-1/+36
* Highlights both 1st level and 2nd level quotes and signatures. * This also sets the edge to 78 columns, as is recommended for email and enables word wrapping. The edge mode is not set, since it kind of looks ugly in Scinterm. * Helps when using SciTECO as the email editor for instance in the Aerc mail client. * Unfortunately, we cannot set up Scintilla to automatically break words after 78 columns (or perhaps that's a good thing). You can use the M#rf reformat-paragraph macro to reflow paragraphs before sending the mail. This will take the edge column into account even if no edge mode is set.
2025-03-01GTK: improved the RGB values of the 16 default colorsRobin Haberkorn1-18/+48
* Using the same values as on Curses/scinterm resulted in too dark colors with terminal.tes. (solarized.tes actually defines all colors with its own RGB values, so the look has always been consistent between Curses and GTK.) This is because the values like 0xFF0000 for red are actually just placeholders in Scinterm, in turn translated internally to Curses colors, which are interpreted by terminal emulators with possibly various different color palettes. * We therefore now use the exact RGB values as will be used by common terminal emulators like xterm and st. It does not guarantee that the colors will always match between Curses and GTK, but at least the GTK colors are now a bit brighter.
2025-02-16implemented mouse support via special ^KMOUSE and <EJ> with negative keysRobin Haberkorn1-0/+68
* You need to set 0,64ED to enable mouse processing in Curses. It is always enabled in Gtk as it should never make the experience worse. sample.teco_ini enables mouse support, since this should be the new default. `sciteco --no-profile` won't have it enabled, though. * On curses, it requires the ncurses mouse protocol version 2, which will also be supported by PDCurses. * Similar to the Curses API, a special key macro ^KMOUSE is inserted if any of the supported mouse events has been detected. * You can then use -EJ to get the type of mouse event, which can be used with a computed goto in the command-line editing macro. Alternatively, this could have been solved with separate ^KMOUSE:PRESSED, ^KMOUSE:RELEASED etc. pseudo-key macros. * The default ^KMOUSE implementation in fnkeys.tes supports the following: * Left click: Edit command line to jump to position. * Ctrl+left click: Jump to beginning of line. * Right click: Insert position or position range (when dragging). * Double right click: insert range for word under cursor * Ctrl+right click: Insert beginning of line * Scroll wheel: scrolls (faster with shift) * Ctrl+scroll wheel: zoom (GTK-only) * Currently, there is no visual feedback when "selecting" ranges via right-click+drag. This would be tricky to do and most terminal emulators do not appear to support continuous mouse updates.
2024-12-30support +line[,column] and filename:line:column syntaxes when opening filesRobin Haberkorn2-2/+39
* This is done via the new opener.tes in the standard library. * Some programs that use $EDITOR expect the +line syntax to work. * You can copy filename:line:column directly from GCC error messages and filename:line from grep output. * Since there may be safe file names beginning with "+" or containing colons, there needs to be a way to turn this off, especially for scripts that don't know anything about the filenames to open. This is done with "--". Unfortunately, the first "--", that stops parameter processing, is always removed from the command line and not passed down into TECO land. This is not a problem for stand-alone scripts, since the script filename is already stopping option processing, so "--" would get passed down. But when calling the profile via `sciteco -- ...`, you could prevent leading minus signs to cause problems but since the `--` is removed, opener.tes cannot use it as a hint. Therefore, we introduced `-S` as a new alternative to `--`, that's always passed down as `--` (i.e. it is equivalent to "-- --"). In other words, `sciteco -S *` will always open exactly the specified files without any danger of misinterpreting certain file names. Should we ever switch to a custom option parsing algorithm, we might preserve "--" (unless after --mung) and thus get rid of "-S". * This advanced behavior can be tweaked by the user relatively easily. In the easiest case, we could replace M[opener] with <:L;R 0X.f [* @EB/^EN.f/ ]* L> in ~/.teco_ini to completely disable the special syntax.
2024-12-24added session.fossil for setting up buffer sessions per Fossil repositoryRobin Haberkorn1-0/+0
* This goes into session.vcs as well. * `fossil info` does not allow printing only the local-root property, so we have to do some parsing afterwards.
2024-12-24simplified session.svn: no need to mess around with XMLRobin Haberkorn1-0/+0
* In fact, since SVN has --no-newline, this is even simpler than on Git and Mercurial. * This requires at least Subversion v1.9 (2015, so should be safe).
2024-12-24introduced true block and EOL commentsRobin Haberkorn78-134/+146
* The previous convention of !* ... *! are now true block comments, i.e. they are parsed faster, don't spam the goto table and allow embedding of exclamation marks - only "*!" terminates the comment. * It is therefore now forbidden to have goto labels beginning with "*". * Also support "!!" to introduce EOL comments (like C++'s //). This disallows empty labels, but they weren't useful anyway. This is the shortest way to begin a comment. * All comment labels have been converted to true comments, to ensure that syntax highlighting works correctly. EOL comments are used for single line commented-out code, since it's easiest to uncomment - you don't have to jump to the line end. This is a pure convention / coding style. Other people might do it differently. * It's of course still possible to abuse goto labels as comments as TECO did for ages. * In lexing / syntax highlighting, labels and comments are highlighted differently. * When syntax highlighting, a single "!" will first be highlighted as a label since it's not yet unambiguous. Once you type the second character (* or !), the first character is retroactively styled as a comment as well.
2024-12-14update sciteco.tes: this again highlights commands, but not Q-Register namesRobin Haberkorn1-2/+2
It's a bit easier on the eyes.
2024-12-13fixed lexer.checkheader: restore dot in case of successRobin Haberkorn1-1/+1
2024-12-13fixup 244a54a18b7db6af177c9d10f3224772f08d7484: abuse the Scintilla view's ↵Robin Haberkorn1-1/+1
"identifier" to enable lexing in the container * SCI_SETILEXER(NULL) is not a reliable way to do that since that's the default for all views. * This was breaking the git.tes lexer for instance and was unnecessarily driving teco_lexer_style() on plain-text documents. * Since we currently do not implement the ILexer5 C++ interface and teco_view_t is just a pointer alias, we are abusing the view's "identifier" instead. This is probably sufficient, as long as there is only one lexer "in the container". Otherwise, there should perhaps be a single C++ class that does nothing but wrapping a callback into an ILexer5 object with a C ABI.
2024-12-13implemented Scintilla lexer for SciTECO code, i.e. TECO syntax highlightingRobin Haberkorn2-1/+22
* this works by embedding the SciTECO parser and driving it always (exclusively) in parse-only mode. * A new teco_state_t::style determines the Scintilla style for any character accepted in the given state. * Therefore, the SciTECO lexer is always 100% exact and corresponds to the current SciTECO grammer - it does not have to be maintained separately. There are a few exceptions and tweaks, though. * The contents of curly-brace escapes (`@^Uq{...}`) are rendered as ordinary code using a separate parser instance. This can be disabled with the lexer.sciteco.macrodef property. Unfortunately, SciTECO does not currently allow setting lexer properties (FIXME). * Labels and comments are currently styled the same. This could change in the future once we introduce real comments. * Lexers are usually implemented in C++, but I did not want to draw in C++. Especially not since we'd have to include parser.h and other SciTECO headers, that really do not want to keep C++-compatible. Instead, the lexer is implemented "in the container". @ES/SCI_SETILEXER/sciteco/ is internally translated to SCI_SETILEXER(NULL) and we get Scintilla notifications when styling the view becomes necessary. This is then centrally forwarded to the teco_lexer_style() which uses the ordinary teco_view_ssm() API for styling. * Once the command line becomes a Scintilla view even on Curses, we can enabled syntax highlighting of the command line macro.
2024-12-08implemented the ^Q command for converting between line and glyph positionsRobin Haberkorn2-7/+7
* As known from DEC TECO, but extended to convert absolute positions to line numbers as well. :^Q returns the current line. * Especially useful in macros that accept line arguments, as it is much shorter than something like ^E@ES/LINEFROMPOSITION//+Q.l@ES/POSITIONFROMLINE//:^E-. * On the other hand, the fact that ^Q checks the line range means we cannot easily replace lexer.checkheader with something like [:J 0,^Q::S...$ ]: Using SCI_POSITIONFROMLINE still has the advantage that it returns `Z` for out-of-bounds ranges which would be cumbersome to write with the current ^Q. * Perhaps there should be a separate command for converting between absolute lines and positions and :^Q should be repurposed to return a failure boolean for out-of-range values? * fnkeys.tes could be simplified.
2024-12-06support the ::S anchored search (string comparison) command (and ::FD, ::FR, ↵Robin Haberkorn5-4/+4
::FS as well) * The colon modifier can now occur 2 times. Specifying `@` more than once or `:` more than twice is an error now. * Commands do not check for excess colon modifiers - almost every command would have to check it. Instead, a double colon will simply behave like a single colon on most commands. * All search commands inherit the anchored semantics, but it's not very useful in some combinations like -::S, ::N or ::FK. That's why the `::` variants are not documented everywhere. * The lexer.checkheader macro could be simplified and should also be faster now, speeding up startup. Eventually this macro can be made superfluous, e.g. by using 1:FB or 0,1^Q::S.
2024-12-04use the new ^Y, ^S and @Xq commands in tedoc.tes and string.tesRobin Haberkorn1-1/+1
2024-11-24lexer.auto: use case-sensitive searchesRobin Haberkorn1-0/+0
* lexer.checkheader is therefore case-sensitive now as well
2024-11-24added special Q-Register ":" for accessing dotRobin Haberkorn2-9/+5
* We cannot call it "." since that introduces a local register and we don't want to add an unnecessary syntactic exception. * Allows the idiom [: ... ]: to temporarily move around. Also, you can now write ^E\: without having to store dot in a register first. * In the future we might add an ^E register as well for byte offsets. However, there are much fewer useful applications. * Of course, you can now also write nU: instead of nJ, Q: instead of "." and n%: instead of "nC.". However it's all not really useful.
2024-11-11session.tes: store the current tab style (width and hard-tabs); fixed for ↵Robin Haberkorn1-0/+0
filenames containing ASCII 27 * You can now set a per-file tab style, that differs from the defaults established in the ED hook. This is important especially since we do not yet support per-project .teco_ini scripts where you could establish differing policies depending on the VCS repository. (The latter would be easy to implement, but we cannot currently easily extend the existing ED hooks.) * It's unlikely that files contain an ASCII 27, but not impossible. Therefore we now use ASCII 0 (^@) as a terminator. This indeed be safe under UNIX. Even better would be a string building construct for escaping ASCII 27 ($), though, as that would work with arbitrary bytes.
2024-10-16Solarized color scheme: fixed F5 function key macroRobin Haberkorn1-2/+2
The macro prefix was changed from ^F to ^K.
2024-09-26Git lexer: added support for TAG_EDITMSG and MERGE_MSGRobin Haberkorn1-0/+2
* Curses: "icons" have also been added