Age | Commit message (Collapse) | Author | Files | Lines |
|
My patch has been merged, so there is no need to keep the workaround
in newer versions.
See https://lists.gnu.org/archive/html/bug-ncurses/2025-09/msg00027.html
|
|
* We have to process several mouse events for every KEY_MOUSE.
* The order of events is sort of arbitrary after clicking the middle mouse button
in some terminal emulators like st and Xterm.
Therefore BUTTON2_PRESSED is now ignored and resynthesized when
receiving BUTTON2_RELEASED.
This fixes loosing middle click events.
fnkeys.tes only processes the RELEASED event anyway.
I am still looking for a fix to contribute to the ncurses project.
* In GNOME Terminal and Xterm with the SGR mouse protocol,
you can receive bogus BUTTON3_PRESSED events when left scrolling.
There is an upstream fix.
As a workaround -- we will have to live with outdated ncurses
versions anyway -- we prevent resetting the mouse mask unnecessarily.
This limits the effects to a single bogus BUTTON3_PRESSED event.
Unfortunately, it's not easily possible to force ncurses into using
the X10 mouse protocol even if the terminfo entry claims SGR compatibility.
See also https://lists.gnu.org/archive/html/bug-ncurses/2025-09/msg00016.html
|
|
* It requires a forced refresh on startup (even though that should be the
default). Otherwise, it wouldn't print the info line correctly.
* Redirect stdin and pass it to newterm() to fix key queuing.
Probably necessary for supporting ncurses on NetBSD as well.
* Avoid doupdate() if screen is too small: fixes crashes for very
small windows.
* Updated Scintilla: There were some implicit typing assumptions,
that are broken by this platform.
|
|
corner cases)
* pkg-config check for `ncurses` fails if it failed previously for `ncursesw`.
This is the case e.g. for ncurses from NetBSD's pkgsrc.
* No longer assume that any libncurses is not enhanced (X/Open compatible).
* SciTECO and Scinterm require to find a curses.h in the include paths.
The ncurses check must therefore not be limited to the first best
ncurses/ncurses.h and the like.
* We now always check for X/Open compatibility and always require
a curses.h in the standard directories or as given by pkg-config.
* AX_WITH_CURSES was radically rewritten and is now called AX_WITH_NCURSES.
* --with-interface=netbsd-curses gets its own detection code.
It always requires a curses.h in the standard paths and a libcurses.
It should now be fixed for real NetBSD installations if the ncurses
port is installed as well.
* Unified all of the curses-arguments to CURSES_CFLAGS and CURSES_LIBS.
There is no reason we need PDCURSES_CFLAGS, XCURSES_CFLAGS etc.
|
|
teco_interface_init_screen()
User messages printed in interative mode aren't currently fully preserved on stdout/stderr
since they are redirected to /dev/null.
Only messages that are not flushed out will be preserved.
Unless you redirect stdout/stderr of SciTECO of course since in this case no redirection
is necessary.
This is probably tolerable esp. once we support multi-line messages in the UIs.
At least it would be tricky to work around.
|
|
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.
|
|
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.
|
|
* 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.
|
|
* Many terminal emulators won't have the status-line terminfo capabilities
but still support OSC-0 escape sequences for setting the window title.
This affects the real XTerm, rxvt-based and many emulators that claim to be
XTerm via $TERM (e.g. GNOME Console).
* It seems we can safely assume that any emulator with $TERM beginning with "xterm" or
"rxvt" does in fact have OSC-0 or at least ignores it.
The number of whitelisted emulators might be extended later on.
This way, we don't have to add another ED flag.
* We still give precendence to the to_status_line/from_status_line capabilities
if they are in terminfo.
|
|
* `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"`.
|
|
* `[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
|
|
* 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.
|
|
|
|
* 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.
|
|
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.
|
|
|
|
* 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.
|
|
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
|
|
* 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.
|
|
backgrounds
* Unfortunately we cannot use `wbkgdset(win, A_REVERSE)` if we plan to
use reverse text on this background, i.e. if we want to cancel out the background A_REVERSE.
* SciTECO therefore no longer uses background attributes, but only foreground attributes.
When setting a reverse text, we XOR A_REVERSE into the previous attributes.
* This fixes control characters especially in the info line and popups, as well as rendering
of the popup scroll bars.
* The command-line should now be rendered properly even on a dark-on-bright color theme
(which does not yet exist).
|
|
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.
|
|
* SCI_COLOR_PAIR() is now a function teco_color_pair() since it also became
an inline function in Scinterm.
|
|
* 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.
|
|
* If the background color would be non-black, render text in reverse
video. ncurses doesn't do that automatically.
* Fixes rendering under historical terminals like VT100 and VT240,
but also all of the monochrome versions of modern emulators in terminfo.
* This also improves the situation when $TERM is set to something conservative,
e.g. when connecting via RS232.
* Scinterm is temporarily changed to my own fork, which already contains
a monochrome patch.
|
|
* As an alternative to OSC-52, which is rarely supported by terminal emulators.
* Makes the new mouse support much more useful since you rely on good builtin
clipboard support. You can no longer e.g. just double-click a word to copy it into
the "primary" selection as terminal emulators do by default.
* Set $SCITECO_CLIPBOARD_SET/GET e.g. to xclip, way-copy, pbcopy or some wrapper script.
* This is currently using POSIX-specific popen() API, so it behaves a bit different
to command execution via EC/EG.
I am not sure if it's worth rewriting with the GSpawn-API, since it will be used
only on POSIX anyway and a GSpawn-based implementation is likely to be a bit larger.
* Should there be some small command-line utility for interacting (esp. pasting) via OSC-52,
built-in OSC-52 support could well be removed from SciTECO.
Currently, I know only of https://github.com/theimpostor/osc/ and it requires
very recent Go compilers. (I still haven't tested it. Quite possibly, pasting when run as
a piped command is impossible.)
|
|
(or generally when keeping it on screen even unchanged)
* Turns out that updating the hardware cursor - which is not displayed anyway - would cause premature
screen updates in teco_interface_refresh(), thus causing flickering, for instance
when quickly cycling through the auto completion popup.
Or even just when clicking its borders which does not change it.
* Touching the popup window is actually important and expected since
Scinterm is also touching its window by completely redrawing it.
Touching the popup window makes sure, it's still copied into newscr and overlaps
the Scintilla view even if the popup did not change - e.g. when pressing an unassigned
function key or clicking on the popup borders.
|
|
popup window
|
|
* Curses allows scrolling with the scroll wheel at least
if mouse support is enabled via ED flags.
Gtk always supported that.
* Allow clicking on popup entries to fully autocomplete them.
Since this behavior - just like auto completions - is parser state-dependant,
I introduced a new state method (insert_completion_cb).
All the implementations are currently in cmdline.c since there is some overlap
with the process_edit_cmd_cb implementations.
* Fixed pressing undefined function keys while showing the popup.
The popup area is no longer redrawn/replaced with the Scintilla view.
Instead, continue to show the popup.
|
|
* Fixes scrolling with default ^KMOUSE macro from fnkeys.tes which adjusts
the scroll position without changing dot.
The unconditional SCI_SCROLLCARET would effectively prevent scrolling to any position
that does not contain dot.
|
|
* 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.
|
|
|
|
|
|
* g_utf8_get_char_validated() returns -2 for null-bytes (sometimes!?)
|
|
This is a purely cosmetic change.
|
|
* 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.
|
|
* g_assert() apparently does not reference the expression when assertions are disabled
in contrast to glibc's assert()
|
|
|
|
* Has been observed on PDCursesMod/WinGUI when pressing CTRL+Shift+6 on an US layout.
I would expect code 30 (^^) to be inserted, instead PDCurses reports two keypresses (6^^).
The first one is now filtered out since this will not be fixed upstream.
See also https://github.com/Bill-Gray/PDCursesMod/issues/323
* Since AltGr on German layouts is reported as CTRL+ALT, we must be careful not to filter those
out as well.
* This is active on all PDCurses variants - who knows which other platforms will behave similarily.
* You still cannot insert code 0 via CTRL+@ since PDCurses doesn't report it, but ncurses does not allow that either.
This _could_ be synthesized by evaluating the modifier flags, though.
|
|
* Fixes the test suite on PDcurses/Win32 and therefore CI builds.
* Should be necessary on UNIX as well since later on, we would access
cmdline_window, which is not yet initialized.
I didn't see any errors in Valgrind, though.
|
|
* Apparently, netbsd-curses overwrites the escdelay on initscr() (if $ESCDELAY is not set),
so we have to apply the default 25ms after screen initialization.
* The info line is not drawn correctly on netbsd-curses, but only on st/simpleterm.
I assume this is just a shortcoming of the included terminfo entry.
|
|
* added TECO_ERROR_CLIPBOARD for all clipboard-related errors
|
|
* Curses: "icons" have also been added
|
|
|
|
* The XTerm version is still checked if we detect running under XTerm.
* Actually, the XTerm implementation is broken for Unicode clipboard contents.
* Kitty supports OSC-52, but you __must__ enable read-clipboard.
With read-clipboard-ask, there will be a timeout.
But we cannot read without a timeout since otherwise we would hang indefinitely
if the escape sequence turns out to not work.
* For urxvt, I have hacked an existing extension:
https://gist.github.com/rhaberkorn/d7406420b69841ebbcab97548e38b37d
* st currently supports only setting the clipboard, but not querying it.
|
|
* This is especially important on platforms, requiring the wgetch()
poll workaround to detect CTRL+C (PDCurses/WinGUI).
wgetch(cmdline_window) would implicitly wrefresh(cmdline_window),
which resulted in additional flickering when pressing function keys.
This is no longer so important since key macros are processed
as an unity and the cmdline will be updated only after processing
all of the characters contained in them, ie. only once after the key press.
Still, there could have still been unwanted side effects.
At the very least, wgetch(input_pad) should be faster.
* The XTerm clipboard implementation was getch()ing on stdscr,
so potentially suffered from the same problem.
It should be tested again.
* Since keypad() is now always enabled even on netbsd-curses.
I assume that the function key processing bug in netbsd-curses
has been fixed by now. We are not building any releases with
netbsd-curses. But it should be retested.
* It does not resolve all flickering issues on PDCurses/WinGUI.
Both the command line and the Scintilla view still flicker near
the cursor. See
https://github.com/Bill-Gray/PDCursesMod/issues/322
|
|
* Turns out that "%C" in wprintw() does not work with non-ANSI chars.
* We still don't want to introduce the Curses widechar API,
so I added teco_curses_add_wc() as a replacement for wadd_wch().
|
|
* Practically requires one of the "Nerd Font" fonts,
so it's disabled by default.
Add 0,512ED to the profile to enable them.
* The new ED flag could be used to control Gtk icons as well,
but they are left always-enabled for the time being.
Is there any reason anybody would like to disable icons in Gtk?
* The list of icons has been adapted and extended from exa:
https://github.com/ogham/exa/blob/master/src/output/icons.rs
* The icons are hardcoded as presorted lists,
so we can binary search them.
This could change in the future. If there is any demand,
they could be made configurable via Q-Registers as well.
|