Age | Commit message (Collapse) | Author | Files | Lines |
|
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.
|
|
* After re-benchmarking the performance, I in fact detected a 20-25% speedup if
memory limiting is active. Both using `time` and the builtin monotic timer ::^B.
When memory limiting is disabled, there is no detectable difference to jemalloc.
The following test case was used:
sciteco -e '::^BUs 100000<@^U[^E\a]"^E\a" %a> ::^B-Qs='
* I also played around with getrusage(), but it doesn't seem to be a viable
API for detecting the currently used RSS, i.e. it does not allow recovering
from OOMs.
|
|
$$ into the commandline
|
|
support the append operation (:Xq, :^Uq...)
Works via a default implementation in the "external" Q-register "class"
by first querying the string, appending and re-setting it.
|
|
* regression introduced in 2baa14add6d9976c29b27cf4470bb458a0198694
|
|
* In this case we always save the given buffer and never the current Q-Register.
* The current Q-Register is only saved without any numeric argument.
The same semantics make sense for <EF> so that Q*EF closes the current buffer
even when editing a Q-Register.
* This variant is present in Video TECO.
|
|
* 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.
|
|
* `static const char *p = "FOO"` is not a true constant since
the variable p can still be changed.
It has to be declared as `static const char *const p = "FOO"`,
so that the pointer itself is constant.
* In case of string constants, it's easier however to use `static const char p[] = "FOO"`.
|
|
* These were leaked e.g. in case of end-of-macro errors,
but also in case of syntax highlighting (teco_lexer_style()).
I considered to solve this by overwriting more of the end_of_macro_cb,
but it didn't turn out to be trivial always.
* Considering that the union in teco_machine_main_t saved only 3 machine words
of memory, I decided to sacrifice those for more robust memory management.
* teco_machine_qregspec_t cannot be directly embedded into teco_machine_main_t
due to recursive dependencies with teco_machine_stringbuilding_t.
It could now and should perhaps be allocated only once in teco_machine_main_init(),
but it would require more refactoring.
|
|
* `[q]~` was broken and resulted in crashes since it reset the clipboard character to 0.
In fact, if we don't want to break the `[a]b` idiom we cannot use the numeric cell
of register `~`.
* Therefore we no longer use the numeric part of register `~`.
Once the clipboard registers are initialized they completely replace
any existing register with the same name that may have been
set in the profile.
So we still don't leak any memory.
(But perhaps it would now be better to fail with an error
if one of the clipboard registers already exist?)
* Instead, bit 10 (1024) of ED is now used to change the default
clipboard to the primary selection.
The alternative might have been an EJ flag or even a special register containing
the name of the default clipboard register.
* partially reverses 8c6de6cc718debf44f6056a4c34c4fbb13bc5020
|
|
* 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.
|
|
* It continues to default to 67 (C), which is the system clipboard.
But you can now overwrite it e.g. by adding `^^PU~` to the profile.
* This fixes a minor memory leak:
If you set one of the clipboard registers in the profile (initializing
them as plain registers), the clipboard register had been leaked.
The clipboard registers now replace any existing register,
while at the same time preserving the numeric part.
* All remaining Q-Reg table insertions use a new function
teco_qreg_table_insert_unique() which adds an assertion, so that
we notice any future possible memory leaks.
|
|
|
|
* 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.
|
|
codepoints in a strtoul()-like manner
|
|
* On interfaces, which only support smooth scrolling, we had to emulate
discrete events. Moreover, once we enabled GDK_SMOOTH_SCROLL_MASK,
systems that would previously report discrete UP/DOWN events, would
suddenly report GDK_SCROLL_SMOOTH.
* Converting from smooth scroll events to discrete scroll events
turned out to be trickier than anticipated.
Scrolling was therefore more sluggish than it used to be before
2f448c976889fe60aba8557b5aa4aa0a0d939281.
* Scrolling is therefore now delegated to a GtkEventControllerScroll,
which is used to synthesize a discrete GDK_SCROLL event that's
fed into the usual event pipeline via teco_interface_input_cb().
|
|
* We must call teco_interface_bytes2glyphs() only ever with byte offsets
that already exist in the buffer.
* regression, introduced in aaa1d51a4c85fcc627e88ef7cf5292d9c5f5f840
|
|
* We have to avoid `/*` within comments, so one of the two characters will
have to use a named glyph.
\[**] is actually a special symbol, which wasn't noticed until supporting Unicode.
There is no named glyph for the plain asterisk.
Thus we now use \[sl] to escape the `/` character.
`/\c*` might have also worked.
* grosciteco now supports the `sl` glyph.
|
|
|
|
* PDCurses is practically used only for Windows builds, which only I build presumably,
so it should be okay to bump the version.
* Older PDCurses versions had serious problems like not detecting BUTTONX_RELEASED events.
This was worked around and is fixed now.
Even the Wincon version behaves like ncurses now with regard to mouse events.
* We no longer have to support processing BUTTONX_CLICKED events.
On the downside the mouse mask had to be adapted.
* See also https://github.com/Bill-Gray/PDCursesMod/issues/330
* We also no longer have to call resize_term(0,0).
|
|
This reverts commit 8cc704b897f33d6150156c77202a29222b9ee667.
This is no longer necessary with PDCurses v4.5.1.
Keeping compatibility with old PDCurses versions is not very important
as only I currently build and provide Windows binaries.
Also, the previous workaround decreases usability on PDcurses/wincon even
with a newer PDCurses library.
|
|
* Apparently, we cannot disable smooth scrolling on a per-application basis,
so I have to handle both discrete and smooth scrolling events.
* Since SciTECO's scroll API (-EJ) is based on discrete scrolling, we now
emulate discrete scroll events by accumulating the delta_y of smooth scroll events.
The threshold value of 12 is chosen arbitrarily, but based on an example in
the Gtk documentation.
|
|
* 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.
|
|
Clang static analyzer
There was the possibility that an unitialized value is passed into a got_register_cb().
This could only happen in normal parse mode and it's unlikely to have caused problems in practice
as all callbacks should not rely on qreg being valid in parse-only mode.
This sort of bug would have also been catched by Valgrind.
The rest of the scan-build-reported warnings are bogus
(caused by not being g_auto-aware).
|
|
* 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.
|
|
* Now, `I^P` can replace `EI`.
EI is therefore now free to be repurposed as the new "mung file" command for improved TECO-11 compatibility.
* On the downside when inserting large blocks of TECO code, you will have to write something like
`@I{^P !...! }`
* The construct is also useful when searching for carets as in `S^P^Q^`.
|
|
* 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.
|
|
* When popping from the Q-Register stack to local Q-Registers in macro calls,
problems would arise when rubbing out that macro call since we would eventually restore
a pointer that has been permanently freed along with the local Q-Registers.
* Naturally this could result in everything from Valgrind warnings to crashes.
* Added test case.
* There is still a test case that fails when run under `--valgrind`,
but it's apparently due to a glib-internal memory leak.
|
|
* This currently folds only {...} string arguments and embedded braces,
most prominently `@^Um{...}` macro definitions..
* Any additional folding for loops and IF-statements should rely on book
keeping by the main parser.
This would also help catch syntactic errors, like dangling IFs.
* We do keep track of the loop nesting, but currently only in execution mode.
* It cannot be disabled via the "fold" property.
Lexers in the container do not have properties.
|
|
The ^KMOUSE macro can also change dot and it was possible
to place dot into invisible areas at the end of the document.
|
|
* 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.
|
|
* The GdkWindow stacking order obviously got messed up when swapping out
the child widget in the GtkEventBox.
* This was probably also responsible for input events coming through
to the Scintilla view even though the GtkEventBox should block all
input events from reaching the Scintilla view.
The event masking in teco_view_new() is probably no longer necessary -
but better keep it to be on the safe side.
|
|
touch and scroll events
* You could drag and drop text into the Scintilla views, which would confuse SciTECO.
* In the future, we might actually want to support programmable drag-and-drop
support via special key macros.
|
|
|
|
* There are cases, especially where the entire buffer is piped through some
external process or when removing and reinserting large parts of the buffer,
that dot changes very little, but the vertical scrolling position gets resets.
This is especially noticable with the macro @^U{[: HECcat$ ]:},
but also with M#cf (clang-format wrapper from "Useful macros").
* We now try to preserve the vertical position ("first visible line")
before scrolling caret.
|
|
* At least on Windows it was observed that teco_interface_get_ansi_key()
would find ANSI keys on other layouts, but nothing corresponding to the key itself.
For instance, for a dead caret (^), we'd find backslash.
This made it impossible to type caret in the parser start states.
* We clumsily detect whether a keyevent refers to a dead key by checking its
symbolic name and pass it down to the input method unmodified.
* Fixes entering dead keys, at the very least on Windows, but potentially
on all other systems as well.
|
|
document's boundaries
|
|
This is hardcoded, but in line with the current defaults from
fnkeys.tes.
|
|
* Both the WinGUI and Wincon variants have their own idiosyncrasies:
* WinGUI ignores `mouseinterval(0)` and may report BUTTONX_CLICKED
for very quick clicks.
Therefore we now emulate separate PRESSED/RELEASED events.
* Wincon does not report BUTTONX_RELEASED at all.
Therefore we still enable click detection, so that fnkeys.tes will
work at least partially.
Therefore we also enable REPORT_MOUSE_POSITION, so that
right-click-dragging will work.
This should still be fixed in PDCurses upstream, though.
* See also https://github.com/Bill-Gray/PDCursesMod/issues/330
|
|
* 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.
|
|
* In other words, fixed `-9223372036854775808\` on --with-teco-integer=64
(which is the default).
* The reason is that ABS(G_MININT64) == G_MININT64 since -G_MININT64 == G_MININT64.
It is therefore important not to call ABS() on arbitrary teco_int_t's.
|
|
|