Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
statement
* this is a SciTECO extension - it's not in TECO-11
* Allows for select-case-like constructs with default-clauses as in
:Os.^EQa$
!* default *!
!s.foo!
!* ... *!
!s.bar!
!* ... *!
* Consistent with nOlabel0,label1,...$ if <n> is out of range.
Unfortunately this form of computed goto is not applicable when
"selecting" by strings or non-consecutive integers.
* In order to continue after the <:O> statement, we must keep the
program counter along with the label we were looking for.
At the end of the macro, the PC is restored instead of throwing
an error.
* Since that would be very inefficient in loops - where potentially
all iterations would result in rescanning till the end of the
macro - we now store a completed-flag in the goto table.
If it is set while trying to :O to an unknown label, we can
just continue execution.
|
|
empty labels are ignored
* This has long been a TECO-11 incompatibility.
* The first label in a list has index 0, i.e. `1Ofoo,bar$` jumps to label `!bar!`.
Consequently 0 is also implied, so `Olabel$` continues to do what you expect.
* `0Ofoo$` was previously also jumping to `!foo!` which was inconsistent:
All invalid indexes should do nothing, i.e. execution continues after the go-to command.
* Fixed handling of empty labels as in `1Ofoo,,bar$` - execution should also continue
after the command.
This eases writing "default" clauses immediately after the go-to.
* The ED hook values now also begin at 0, so most existing ED hook macros should
continue to work.
* Similarily, the mouse events returned by -EJ also begin at 0 now,
so fnkeys.tes continues to work as expected.
* It's still very possible of course that this breaks existing code.
|
|
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.
|
|
commands with multiple string arguments
* When `@`-modifying a command with several string arguments and choosing `{` as the alternative
string termination character, the parser would get totally confused.
Any sequence of `{` would be ignored and only the first non-`{` would become the termination character.
Consequently you also couldn't choose a new terminator after the closing `}`.
So even a documented code example from sciteco(7) wouldn't work.
The same was true when using $ (escape) or ^A as the alternative termination character.
* We can now correctly parse e.g. `@FR{foo}{bar}` or `@FR$foo$bar$` (even though the
latter one is quite pointless).
* has probably been broken forever (has been broken even before v2.0).
* Whitespace is now ignored in front of alternative termination characters as in TECO-64, so
we can also write `@S /foo/` or even
```
@^Um
{
!* blabla *!
}
```
I wanted to disallow whitespace termination characters, so the alternative would have been
to throw an error.
The new implementation at least adds some functionality.
* Avoid redundancies when parsing no-op characters via teco_is_noop().
I assume that this is inlined and drawn into any jump-table what would be
generated for the switch-statement in teco_state_start_input().
* Alternative termination characters are still case-folded, even if they are Unicode glyphs,
so `@IЖfooж` would work and insert `foo`.
This should perhaps be restricted to ANSI characters?
|
|
and also the CTRL+L immediate editing command
* ^W can be added to loops in order to view progress in interactive mode.
It also sleeps for a given number of milliseconds (10ms by default).
* In batch mode it is therefore the sleep command.
* Since CTRL+W is an immediate editing command, you will usually type it Caret+W.
ASCII 23 however will also be accepted.
* While ^W only updates the screen, you can force a complete redraw by pressing CTRL+L.
This is what most terminal applications use for redrawing.
It will make it harder to insert ASCII 12, but this is seldom necessary since it
is a form feed.
^L (ASCII 12 and the upcaret variant ) is still a whitespace character and therefore treated as a NOP.
* DEC TECO had CTRL+W as the refresh immediate editing command.
Video TECO uses <ET> as a regular command for refreshign in loops.
I'd rather keep ET reserved as a potential terminal configuration command
as in DEC TECO, though.
|
|
* DEC TECO had an <EO> command.
In contrast to DEC TECO's implementation, the value reported by
<EO> encodes a major.minor.micro semantic version.
|
|
partially replaces ^B
* :^H and ::^H now return the timestamps, while ^B only returns the date.
* Pressing CTRL+H will rubout, so you will usually write it in upcaret mode.
|
|
stdin or the user
* n:^T always prints bytes (cf. :^A)
* ^T without arguments returns a codepoint or byte from stdin.
In interactive mode, this currentply places a cursor in the message line and waits for a keypress.
|
|
* `0,2ED` is roughly equivalent to `-EX`
* `ED&2` can be used to query whether EX has been run.
This is useful if macros can run EX.
* `2,0ED` could be used to cancel the effect of EX.
* But the real motivation is for implementing a REPL script.
|
|
* Practically all calls to teco_expressions_args() must be preceded by teco_expressions_eval().
* In code paths where we know that teco_expressions_args() > 0, it is safe
to call teco_expressions_pop_num(0) instead of teco_expressions_pop_num_calc().
This is both easier and faster.
* teco_expressions_pop_num_calc() is for simple applications where you just want to get
a command argument with default (implied) values.
Since it includes teco_expressions_eval(), we can avoid superfluous calls.
* -EC...$ turned out to be broken and is fixed now.
A test case has been added.
|
|
current buffer
* refactored some code that is common with Xq into teco_get_range_args().
|
|
* ^A uses the default code page without colon, just like ^U/EU.
This is usually UTF8, unless you run with --8bit.
It would make just as little sense to inherit the codepage from the
current document.
* Ensures that code like `:^A^E<0xFF>^A` really outputs byte 0xFF.
* DEC TECO doesn't have the colon modifier, but it has a colon modifier
for ^T to enforce raw output.
In SciTECO, the ^T vs. :^T distinction will also be between default codepage
and ANSI. It makes sense because ^T should treat its numeric arguments like <I>
for consistency.
|
|
inserting it
|
|
|
|
* Greatly improved usability as a scripting language.
* The command is in DEC TECO, but in contrast to DEC TECO, we also
support string building constructs in ^A.
* Required some refactoring: As we want it to write everything verbatim
to stdout, the per-interface method is now teco_interface_msg_literal()
and it has to deal with unprintable characters.
When displaying in the UI, we use teco_curses_format_str() and TecoGtkLabel
functions/widgets to deal with possible control codes.
* Numbers printed with `=` have to be written with a trailing linefeed,
which would also be visible as a reverse "LF" in the UI.
Not sure whether this is acceptable - the alternative would be to strip
the strings before displaying them.
* Messages written to stdout are also auto-flushed at the moment.
In the future we might want to put flushing under control of the language.
Perhaps :^A could inhibit the flushing.
|
|
the error message
|
|
There will be a lot more commands for terminal/message
input and output soon.
|
|
Small slow downs will not be noticable for interactively executed commands,
so we can well discriminate (G_UNLIKELY) against such code paths.
|
|
* These are famously in DEC TECO-11, but also in Video TECO.
* The implementation is tricky. They need to use lookahead states,
but this would be inacceptable during interactive execution.
Therefore only if executing from the end of the command line
`==` and `===` are allowed to print multiple values.
The number is therefore also not popped form the stack immediately
but only peeked. It's popped only when it has been decided that
the command has ended.
* This may break existing macros that use multiple `=` in a row
to print multiple values from the stack.
You will now e.g. have to insert whitespace to separate such `=` commands.
|
|
* Added some keywords.
* Consistently added command variants with all modifiers.
In principle including modifiers in the topics is unnecessary -
you can always strip the modifiers and look up the raw command.
However, looking up a command with modifiers can speed up the process
(compare looking up ?S<TAB> vs ?::S<TAB>
* The `@` modifier is listed only for commands without string arguments.
|
|
* While it doesn't directly change the buffer's contents in bytes,
a subsequent write would result in a different file on disk,
so it is consequent to remind the user of saving or discarding changes.
* Will also fix :EX after changing the EOL mode.
|
|
* Could be used to check whether the stack is currently empty,
although peeking would be cumbersome: `:]q"S [q !...! | !...! '`
* This is from DEC TECO-11.
|
|
* This command exists in Video TECO.
In Video TECO it also supports reading multiple files with a glob pattern -- we do not support that
as I am not convinced of its usefulness.
* teco_view_load() has been extended, so it can read into dot without
discarding the existing document.
|
|
* ED hooks are not executed in this case
* <EF> is now allowed even when editing a Q-Reg, unless you try to close the
current buffer
|
|
* It is encoded with the same formula as on VAX/VMS on TECO-11, on TECOC and TECO-64.
* As an extension, when colon-modified it returns the number of seconds since the epoch.
It might be even more useful to return the microseconds since the epoch, but that would require
64-bit integers, which can theoretically be disabled at build time.
|
|
* Previously, deleting text after a text match or insertion
could result in wrong ^S/^Y results.
In particular, the amount of characters deleted by <FD> at the end of a buffer
couldn't be queried.
* This also fixes the M#rf (reflow paragraph) macro.
|
|
* This is not in Video TECO, but TECO-11 has a search-and-replace variant of <N>.
<N> however is a search-over-page-boundary command in TECO-11, which has been repurposed
as search-over-buffer-boundary in Video TECO and SciTECO.
* <N> and <FN> no longer call the edit hook after *every* invocation, but only
if the current buffer changes. This is not really relevant with the current
default hook from fallback.teco_ini, but might be depending on the use case.
* Added testcases both for <N> and <FN>.
|
|
* The old behavior of throwing an error was inherited from Video TECO.
* The command is now more similar to TECO-11.
* Since -1 is taken, invalid and incomplete UTF-8 byte sequences
are now reported as -2/-3.
I wasn't really able to provoke -3, though.
|
|
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.
|
|
* This may break existing macros!
^C is now essentially a synonym for $$ and may not terminate the program
when called from a non-toplevel macro frame.
However it improves compatibility with TECO-11.
* In contrast to TECO-11, ^C^C (exit) can be typed completely in upcaret mode.
Otherwise it wouldn't have been possible to use the exit command in ASCII-only scripts.
* The implementation of ^C^C uses a lookahead state similar to ^[ (escape).
^C does not return immediately, but the following character determines whether it will
perform a return or exit.
It's one of the rare cases in SciTECO where this is possible and safe since
^C is also disallowed on the command-line to avoid undesired command-line terminations
after ^C interruptions.
(You can only use $$ to terminate the command-line interactively.)
|
|
* Any value left on the numeric stack now determines the exit code.
This ensures you can call n^C as the SciTECO version of exit(n).
It will also work with n$$ in the top level macro.
But you don't necessarily need any of these commands.
* Could be useful in shell scripting as in
`sciteco -e "@EB/file/ :@S/foo/\"F1'"` to fail `foo` is not found.
|
|
replacement register (after `{`)
I found that terminating the command-line while editing the replacement register,
leaves you in a hard-to-recover state. You can/should no longer call `}`, so you would
have to go back to the last buffer (Q*U*).
Instead, this is now checked against and a test case has also been added.
|
|
* It turns out that `bool` (_Bool) in bitfields may cause
padding to the next 32-bit word.
This was only observed on MinGW.
I am not entirely sure why, although the C standard does
not guarantee much with regard to bitfield memory layout
and there are 64-bit available due to passing anyway.
Actually, they could also be layed out in a different order.
* I am now consistently using guint instead of `bool` in bitfields
to prevent any potential surprises.
* The way that guint was aliased with bitfield structs
for undoing teco_machine_main_t and teco_machine_qregspec_t flags
was therefore insecure.
It was not guaranteed that the __flags field really "captures"
all of the bit field.
Even with `guint v : 1` fields, this was not guaranteed.
We would have required a static assertion for robustness.
Alternatively, we could have declared a `gsize __flags` variable
as well. This __should__ be safe since gsize should always be
pointer sized and correspond to the platform's alignment.
However, it's also not 100% guaranteed.
Using classic ANSI C enums with bit operations to encode multiple
fields and flags into a single integer also doesn't look very
attractive.
* Instead, we now define scalar types with their own teco_undo_push()
shortcuts for the bitfield structs.
This is in one way simpler and much more robust, but on the other
hand complicates access to the flag variables.
* It's a good question whether a `struct __attribute__((packed))` bitfield
with guint fields would be a reliable replacement for flag enums, that
are communicated with the "outside" (TECO) world.
I am not going to risk it until GCC gives any guarantees, though.
For the time being, bitfields are only used internally where
the concrete memory layout (bit positions) is not crucial.
* This fixes the test suite and therefore probably CI and nightly
builds on Windows.
* Test case: Rub out `@I//` or `@Xq` until before the `@`.
The parser doesn't know that `@` is still set and allows
all sorts of commands where `@` should be forbidden.
* It's unknown how long this has been broken on Windows - quite
possibly since v2.0.
|
|
|
|
* Instead of separate stand-alone commands, they are now allowed only immediately
in front of the commands that accept them.
* The order is still insignificant if both `@` and `:` are accepted.
* The number of colon modifiers is now also checked.
We basically get this for free.
* `@` has syntactic significance, so it could not be set conditionally anyway.
Still, it was possible to provoke bugs were `@` was interpreted conditionally
as in `@ 2<I/foo/$>`.
* Even when not causing bugs, a mistyped `@` would often influence the
__next__ command, causing unexpected behavior, for instance when
typing `@(233C)W`.
* While it was theoretically possible to set `:` conditionally, it could also
be "passed through" accidentally to some command where it wasn't expected as in
`:Ifoo$ C`.
I do not know of any real useful application or idiom of a conditionally set `:`.
If there would happen to be some kind of useful application, `:'` and `:|` could
be re-allowed easily, though.
* I was condidering introducing a common parser state for modified commands,
but that would have been tricky and introduce a lot of redundant command lists.
So instead, we now simply everywhere check for excess modifiers.
To simplify this task, teco_machine_main_transition_t now contains flags
signaling whether the transition is allowed with `@` or `:` modifiers set.
It currently only has to be checked in the start state, after `E` and `F`.
|
|
* This was actually broken if the command is preceded by `@` and `:` characters, which
are __not__ modifiers.
E.g. `Q:@I/foo^W` would have rubbed out the `:` register as well.
* Also, since it was all done in teco_state_process_edit_cmd(),
it would also rub out modifier characters from within string arguments,
E.g. `@I/::^EQ^W`
* Real commands now have their own ^W rubout implementation, while the generic
fallback just rubs out until the start state is re-established.
This fails to rub out modifiers as in `@I/^W`, though.
* Real command characters now use the common TECO_DEFINE_STATE_COMMAND().
* Added test cases for CTRL+W rub out.
A few control characters are now portably available to tests
via environment variables `$ESCAPE`, `$RUBOUT` and `$RUBOUT_WORD`.
|
|
* They swap the default order of skipping characters.
For positive arguments: first non-word chars, then word chars.
* This is especially useful after executing the non-at-modified versions.
For instance, at the beginning of a word, `@W` jumps to its end.
`@V` would delete the remainder of the word.
* Since they have to evaluate the at-modifier, which has syntactic
significance, the command implementations can no longer use
transition tables, so they are in the switch-statements instead.
|
|
out no-op commands (whitespace)
* In string arguments, ^W first rubs out non-word chars (usually whitespace),
so it makes sense if ^W would work analogously at the command level.
A non-command would be one of the no-ops.
|
|
* All the movement commands have shortcuts for their negative forms:
`R` instead of `-C`, `B` instead of `-L`.
Therefore there was always the need for a `-W` shortcut as well.
* `P` is a good choice because it is a file IO command in TECO-11,
that does not make sense supporting.
In Video TECO it toggles between display windows (ie. split screens)
and I do not plan to support multiple windows in SciTECO.
* Added to the cheat sheet.
|
|
compilation unit move-commands.c
* This made sense to include both `W` and `V`, so we also included `D` and `K`.
`^Q` is included since it converts between lines and glyphs.
* These are all single-letter commands, so they aren't complete parser states
but callbacks to be referenced in teco_machine_main_transition_t.
|
|
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).
|
|
This requires Unicode icon support to be enabled via ED.
The ellipsis symbol is shorter and more distinctive, allowing more of the original
text to be preserved before truncation.
|
|
* <W> was also using keyboard movement commands.
* This fixes an inconsistency between the handling of punctuation characters,
e.g. "(word" followed by -W vs. Y.
|
|
* This has __always__ been broken.
It's been especially annoying when pressing `Y` at the end of a line with trailing whitespace
since the linebreak would also be deleted.
This was because `Y` always deleted the entire word or non-word character-span.
This was inconsistent with `V`.
* We now use SCI_WORDSTART|ENDPOSITION instead of the keyboard commands.
It therefore also requires less Scintilla messages (4+2*n vs. 4+4*n).
Most importantly, we can now check for errors before changing the buffer,
so there is no need to undo anything in case of errors.
This should always be the preferred strategy.
* Added test case.
|
|
* 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.
|
|
Analoguous to :EX, but always saves the file like EW$, not only if it's dirty.
|
|
|
|
|
|
as a separate command)
|