diff options
| -rwxr-xr-x | .fmsbw/10-freebsd14-msys-sciteco | 54 | ||||
| -rwxr-xr-x | .fmsbw/20-freebsd14-osx-sciteco | 7 | ||||
| -rw-r--r-- | .fmsbw/images/Makefile | 51 | ||||
| -rw-r--r-- | .fmsbw/images/msys-activate | 6 | ||||
| -rw-r--r-- | .gitmodules | 2 | ||||
| -rw-r--r-- | ChangeLog | 22 | ||||
| -rw-r--r-- | INSTALL | 11 | ||||
| -rw-r--r-- | NEWS | 5 | ||||
| -rw-r--r-- | README | 2 | ||||
| -rw-r--r-- | TODO | 28 | ||||
| -rw-r--r-- | configure.ac | 16 | ||||
| m--------- | contrib/scinterm | 0 | ||||
| -rw-r--r-- | debian/changelog | 6 | ||||
| -rw-r--r-- | doc/cheat-sheet.mm | 7 | ||||
| -rw-r--r-- | freebsd/Makefile | 2 | ||||
| -rw-r--r-- | src/core-commands.c | 2 | ||||
| -rw-r--r-- | src/interface-curses/interface.c | 61 | ||||
| -rw-r--r-- | src/interface-gtk/gtk-info-popup.c | 4 | ||||
| -rw-r--r-- | src/interface-gtk/gtk-label.c | 22 | ||||
| -rw-r--r-- | src/interface-gtk/gtk-label.h | 2 | ||||
| -rw-r--r-- | src/interface-gtk/interface.c | 4 | ||||
| -rw-r--r-- | tests/atlocal.in | 2 | ||||
| -rw-r--r-- | www/screenshots.md | 4 |
23 files changed, 229 insertions, 91 deletions
diff --git a/.fmsbw/10-freebsd14-msys-sciteco b/.fmsbw/10-freebsd14-msys-sciteco index 037ac66..f8e1f40 100755 --- a/.fmsbw/10-freebsd14-msys-sciteco +++ b/.fmsbw/10-freebsd14-msys-sciteco @@ -1,39 +1,5 @@ #!/usr/local/bin/bash set -ex -export ASSUME_ALWAYS_YES=yes - -# Already in freebsd14-sciteco -# TODO: Build this with buildah. -# Start with --network=host -#pkg update -#pkg install FreeBSD-clang FreeBSD-clibs-dev \ -# gmake pkgconf autoconf automake libtool \ -# glib gtk3 groff doxygen lowdown valgrind -# -#pkg install llvm21 gnugrep gmake coreutils gsed gawk git wget gnupg bash groff zip autoconf automake libtool python3 -#pkg remove FreeBSD-clang -#git clone https://github.com/HolyBlackCat/quasi-msys2.git /opt/quasi-msys2 -#cd /opt/quasi-msys2 -#ln -s /usr/local/bin/gpgv2 /usr/local/bin/gpgv -#ln -s /usr/local/bin/bash /bin/bash -#mkdir -p gnu-overrides -#ln -s /usr/local/bin/ggrep gnu-overrides/grep -#ln -s /usr/local/bin/gmake gnu-overrides/make -#ln -s /usr/local/bin/gsed gnu-overrides/sed -#ln -s /usr/local/bin/greadlink gnu-overrides/readlink -#ln -s /usr/local/bin/wine64 gnu-overrides/wine -#echo MINGW64 >msystem.txt -#cat >activate << EOF -#cd /opt/quasi-msys2 -#export PATH=`pwd`/gnu-overrides:$PATH -#export PKG_CONFIG=pkg-config -#set +ex -#. env/all.src -#set -ex -#EOF -#gmake install _autotools _gcc _libc++ _glib2 _pdcurses _gtk3 _librsvg -#ln -nfs "/opt/quasi-msys2/root/mingw64" /mingw64 -#pkg clean -a autoreconf -i mkdir build-freebsd @@ -75,7 +41,11 @@ cp ico/sciteco-48.png /opt/htdocs/graphics . /opt/quasi-msys2/activate cd /opt/build -export CURSES_CFLAGS=-I/mingw64/include/pdcurses/ +# NOTE: Sometimes the PDCursesMod MSYS upstream package is too old, +# so we also installed v4.5.4 into the container. +#export CURSES_CFLAGS=-I/mingw64/include/pdcurses/ +export CURSES_CFLAGS=-I/opt/PDCursesMod + # FIXME: glib on MinGW supports static linking but the gspawn # helper binaries are still linked dynamically, forcing us to ship # all DLLs anyway. Therefore it makes little sense to link SciTECO @@ -90,25 +60,31 @@ export LDFLAGS="-flto=thin -stdlib=libc++" # We cannot run Windows binaries automatically through Wine, # so we must still force cross-compilation with --host. +# There is a --with-launcher=wine64, but SciTECO is currently +# simply broken under Wine. #autoreconf -i mkdir build-wingui build-wincon cd build-wingui +# See above, we use a manually built PDCursesMod v4.5.4 +#export CURSES_LIBS="-lpdcurses_wingui -lgdi32 -lcomdlg32 -lwinmm" +export CURSES_LIBS="/opt/PDCursesMod/wingui/pdcurses.a -lgdi32 -lcomdlg32 -lwinmm" ../configure --host=x86_64-w64-mingw32 \ --with-interface=pdcurses-gui --enable-html-docs --program-prefix=g \ --with-scitecodatadir=. \ - --disable-bootstrap \ - CURSES_LIBS="-lpdcurses_wingui -lgdi32 -lcomdlg32 -lwinmm" + --disable-bootstrap make make install-strip #make check TESTSUITEFLAGS="--verbose --color=never" cd ../build-wincon +# See above, we use a manually built PDCursesMod v4.5.4 +#export CURSES_LIBS="-lpdcurses_wincon -lgdi32 -lwinmm" +export CURSES_LIBS="/opt/PDCursesMod/wincon/pdcurses.a -lgdi32 -lwinmm" ../configure --host=x86_64-w64-mingw32 \ --with-interface=pdcurses --enable-html-docs \ --with-scitecodatadir=. \ - --disable-bootstrap \ - CURSES_LIBS="-lpdcurses_wincon -lgdi32 -lwinmm" + --disable-bootstrap make make install-strip #make check TESTSUITEFLAGS="--verbose --color=never" diff --git a/.fmsbw/20-freebsd14-osx-sciteco b/.fmsbw/20-freebsd14-osx-sciteco index bef1cfb..5cbd49f 100755 --- a/.fmsbw/20-freebsd14-osx-sciteco +++ b/.fmsbw/20-freebsd14-osx-sciteco @@ -25,12 +25,14 @@ cd .. #UNATTENDED=1 ./build.sh #unset CPPFLAGS #export MACOSX_DEPLOYMENT_TARGET=10.13 -# FIXME: This is not unattended. Perhaps echo https://nue.de.packages.macports.org/macports/packages >target/macports/MIRROR +# FIXME: This is not unattended. +# Perhaps echo https://nue.de.packages.macports.org/macports/packages >target/macports/MIRROR # dylibbundler is available but can't be run naturally. +# FIXME: How to install variants, like the Quartz variant for Gtk3? #osxcross-macports install --static glib2-devel gtk3-devel # #pkg install cmake -#git clone https://github.com/auriamg/macdylibbundler.git /opt/macdylibbundler +#git clone --depth=1 https://github.com/auriamg/macdylibbundler.git /opt/macdylibbundler #cd /opt/macdylibbundler #cmake . #make @@ -68,6 +70,7 @@ cd .. # FIXME: Also build -arch arm64 and package with x86_64-apple-darwin25-lipo into universal binary. # x86_64-apple-darwin25-lipo -lipo -create -output sciteco x86_64/usr/local/bin/sciteco arm64/usr/local/bin/sciteco # TODO: Build Gtk version as well. +# Currently, we cannot install the Quartz variant. mkdir -p /opt/htdocs/downloads/nightly/ cp sciteco-curses_nightly_macos_x86_64.tar.gz /opt/htdocs/downloads/nightly/ diff --git a/.fmsbw/images/Makefile b/.fmsbw/images/Makefile new file mode 100644 index 0000000..0878cc2 --- /dev/null +++ b/.fmsbw/images/Makefile @@ -0,0 +1,51 @@ +# Don't build any image by default +all: + +# Base image for building SciTECO on FreeBSD. +freebsd14-sciteco: + buildah from --name $@-working --network=host quay.io/dougrabson/freebsd14.1-small + buildah config --env ASSUME_ALWAYS_YES=yes $@-working + buildah run $@-working pkg update + buildah run $@-working pkg install FreeBSD-clang FreeBSD-clibs-dev \ + gmake pkgconf autoconf automake libtool \ + glib gtk3 groff doxygen lowdown valgrind + buildah run $@-working pkg clean -a + buildah commit $@-working $@ + +freebsd14-msys-sciteco: + buildah from --name $@-working --network=host freebsd14-sciteco + buildah run $@-working pkg install llvm21 gnugrep gmake coreutils gsed gawk \ + git wget gnupg bash groff zip autoconf automake libtool python3 + #buildah run $@-working pkg remove FreeBSD-clang + buildah run $@-working pkg clean -a + # Cannot check out with --depth=1 as we need a particular commit. + buildah run $@-working git clone https://github.com/HolyBlackCat/quasi-msys2.git /opt/quasi-msys2 + buildah config --workingdir /opt/quasi-msys2 $@-working + buildah run $@-working git checkout e41c4d0f7dde15031132348875d1d01c8d0ea857 + buildah run $@-working ln -s /usr/local/bin/gpgv2 /usr/local/bin/gpgv + buildah run $@-working ln -s /usr/local/bin/bash /bin/bash + buildah run $@-working mkdir -p gnu-overrides + buildah run $@-working ln -s /usr/local/bin/ggrep gnu-overrides/grep + buildah run $@-working ln -s /usr/local/bin/gmake gnu-overrides/make + buildah run $@-working ln -s /usr/local/bin/gsed gnu-overrides/sed + buildah run $@-working ln -s /usr/local/bin/greadlink gnu-overrides/readlink + buildah run $@-working ln -s /usr/local/bin/wine64 gnu-overrides/wine + buildah run $@-working echo MINGW64 '>msystem.txt' + buildah copy $@-working msys-activate activate + buildah run $@-working gmake install _autotools _gcc _libc++ _glib2 _pdcurses _gtk3 _librsvg + buildah run $@-working ln -nfs "/opt/quasi-msys2/root/mingw64" /mingw64 + # The upstream _pdcurses package is often too outdated, so we also build from sources. + buildah run $@-working git clone --depth=1 -b v4.5.4 https://github.com/Bill-Gray/PDCursesMod.git /opt/PDCursesMod + buildah run $@-working bash -c '. /opt/quasi-msys2/activate && gmake -j2 -C /opt/PDCursesMod/wincon CC=$CC AR=$AR' + buildah run $@-working bash -c '. /opt/quasi-msys2/activate && gmake -j2 -C /opt/PDCursesMod/wingui CC=$CC AR=$AR' + buildah commit $@-working $@ + +freebsd14-osx-sciteco: + false # TODO + +ubuntu22-appimage: + false # TODO + +# Remove all temporary containers +clean: + buildah rm --all diff --git a/.fmsbw/images/msys-activate b/.fmsbw/images/msys-activate new file mode 100644 index 0000000..655fcae --- /dev/null +++ b/.fmsbw/images/msys-activate @@ -0,0 +1,6 @@ +cd /opt/quasi-msys2 +export PATH=`pwd`/gnu-overrides:$PATH +export PKG_CONFIG=pkg-config +set +ex +. env/all.src +set -ex diff --git a/.gitmodules b/.gitmodules index af9fd68..841ce77 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,7 +4,7 @@ ignore = untracked [submodule "scinterm"] path = contrib/scinterm - url = https://github.com/rhaberkorn/scinterm.git + url = https://github.com/orbitalquark/scinterm.git [submodule "lexilla"] path = contrib/lexilla url = https://github.com/ScintillaOrg/lexilla.git @@ -6,6 +6,26 @@ using a prebuilt binary) are included. Entries marked with "(!)" might break macro portability compared to the preceding release. +Version 2.5.1 (2026-01-10) +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +* Haiku is officially supported again from now on +* minor documentation improvement for `ED` +* Curses: The command-line uses the hardware cursor by default now. + To re-enable the self-drawn cursor, do something like + `0,2048ED 2#16@ES/SETCARETSTYLE//$ 2048,0ED` +* PDCurses/XCurses (X11): fixed crashes on startup and mouse support + +Regressions introduced by v2.5.0 and now fixed: + +* GTK: Fixed bogus "(Unnamed)" strings in empty message lines +* PDCurses: Fixed reporting of mouse modifiers (CTRL, ALT, SHIFT) +* PDCurses: Fixed colors + (affects the Windows sciteco.exe and gsciteco.exe). +* PDCurses: Fixed hanging after pressing mouse keys + (affects the Windows sciteco.exe and gsciteco.exe). +* PDCurses/WinGUI: Fixed hanging input (affects gsciteco.exe). + Version 2.5.0 (2026-01-01) ~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -115,7 +135,7 @@ Version 2.5.0 (2026-01-01) * implemented ^E<code> string building constructs for embedding bytes and codepoints in a strtoul()-like manner * support <:]q> (pop Q-Register) for getting a success/failure boolean - * support <==> and <===> for printing octal and hexadecimal numbers + * (!) support <==> and <===> for printing octal and hexadecimal numbers * support :=/:==/:=== commands: print number without trailing linefeed * Implemented the <^A> command for printing arbitrary strings. You can use :^A to force raw ANSI output. @@ -3,7 +3,7 @@ Installation Instructions Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. -Copyright (C) 2013-2025 Robin Haberkorn +Copyright (C) 2013-2026 Robin Haberkorn Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright @@ -26,7 +26,7 @@ SciTECO Build and Runtime Dependencies I recommend ncurses 6.0 or later. * NetBSD Curses (https://github.com/sabotage-linux/netbsd-curses). This is the default on NetBSD. - * PDCursesMod v4.5.1 or later (https://github.com/Bill-Gray/PDCursesMod.git). + * PDCursesMod v4.5.4 or later (https://github.com/Bill-Gray/PDCursesMod.git). This is the recommended flavor of PDCurses to use. * PDCurses/EMCurses (https://github.com/rhaberkorn/emcurses). * PDCurses/XCurses (http://pdcurses.sourceforge.net/). @@ -47,7 +47,7 @@ installed by the user manually: * Scintilla (v5.3.0 or later): http://www.scintilla.org/ * When choosing the Curses interface: - * Scinterm (v5.2 or later): + * Scinterm (v5.5 or later): http://foicica.com/scinterm/ * Lexilla (v5.0.0 or later, optional): https://www.scintilla.org/Lexilla.html @@ -75,6 +75,11 @@ On NetBSD: $ sudo pkgin install git gmake pkg-config autoconf automake libtool-base \ glib2 gtk3+ doxygen +On Haiku: + + $ pkgman install git make pkgconfig autoconf automake libtool \ + glib2_devel ncurses6_devel gtk3_devel groff doxygen + Building from Source Tar Ball or Repository =========================================== @@ -2,6 +2,11 @@ News ==== <span class="nf nf-md-new_box"></span> +SciTECO [v2.5.1](https://sciteco.fmsbw.de/downloads/v2.5.1/) has been released. +This is a hotfix release to v2.5.0, which first and foremost fixes the +Windows PDCurses builds. + +<span class="nf nf-md-new_box"></span> SciTECO [v2.5.0](https://sciteco.fmsbw.de/downloads/v2.5.0/) has been released. This release brings many new features, but most importantly makes the language much more usable as a non-interactive scripting language. @@ -27,7 +27,7 @@ All X/Open-compatible libraries should be supported. SVr4 curses without enhanced definitions is **not** supported. Linux, FreeBSD, NetBSD, [Mac OS X](https://sciteco.fmsbw.de/knowledge/Mac%20OS%20Support), -Windows (MinGW 32/64) ~~and [Haiku](https://www.haiku-os.org/) (gcc4)~~ are tested and supported. +Windows (MinGW 32/64) and [Haiku](https://www.haiku-os.org/) (gcc4) are tested and supported. SciTECO compiles with both GCC and Clang. SciTECO should compile just fine on other UNIX-compatible platforms. However UNIX-compatibility is not strictly required: @@ -2,6 +2,7 @@ Tasks: * Have a look at TECO-86. * VEDIT and PMATE for MS-DOS * Scintilla: upstream 2 patches + * HaikuPorts Known Bugs: * OBS GTK builds sometimes fail: "cannot open display" @@ -28,6 +29,9 @@ Known Bugs: This would be necessary for an interactive screen editing script, that leaves you in <I> always. This would require some refactoring. + * GTK on Haiku: CTRL and AltGr-combinations do not work. + The modifiers are not delivered properly and it appears to affect all Gtk apps + on Haiku. * Gtk: The control characters in tutorial.woman are still styled with the variable-width font since its rendered in STYLE_CONTROLCHAR (36), which is reset in woman.tes. @@ -42,15 +46,6 @@ Known Bugs: In some cases, the internal redrawing blocks SciTECO forever. * @ES/SCI_CLEARALLREPRESENTATIONS// does nothing. Might be a Scintilla bug. - * PDCurses/Wincon does not report button released events. - We try to work around this with click detection, - but it still behaves a bit oddly. - See https://github.com/Bill-Gray/PDCursesMod/issues/330 - Waiting for PDCurses in MSYS to be updated. - * PDCurses/WinGUI: There is still some flickering, but it got better - since key macros update the command line only once. - Could already be fixed upstream, see: - https://github.com/Bill-Gray/PDCursesMod/issues/322 * Win32: Interrupting <EC> will sometimes hang. Affects both PDCurses/WinGUI and Gtk. This no longer happens with ECbash -c 'while true; do true; done'$. @@ -59,16 +54,9 @@ Known Bugs: However the UNIX path translation appears to be a Cygwin feature. If SciTECO would do that, it might break other things (e.g. you might want to refer directory C:\mingw64 instead). - * Win32/Wincon: cat ... | sciteco -i - "Redirection is not supported." - PR: https://github.com/Bill-Gray/PDCursesMod/pull/344 - Waiting for an MSYS package releae. - * PDCurses/Win32: Both Wincon and WinGUI crash when you press *any* - non-ANSI character. This is fixed since PDCurses v4.5.2: - https://github.com/Bill-Gray/PDCursesMod/issues/335 - We're waiting for an MSYS package upgrade. - It could also be worked around by using wget_wch() instead of wgetch(). * PDCurses/Win32: Crashes sometimes without any error message. + * PDCurses/WinGUI: CTRL-modifier can get stuck. + Should have already been fixed in 9f9819fe8d. * NetBSD Curses: scrolling apparently uses hardware idl capabilities resulting in graphical glitches on slow terminals. idlok(FALSE) is apparently ignored. @@ -801,6 +789,10 @@ Features: * There could be a key macro script for my Russian-phonetic keyboard layout. This would probably require some new key macro states as well. + * Allow the hardware cursor (CARETSTYLE_CURSES) on the main view as well. + We'd have to handle an overlapping info popup, though. + Should we deactivate the hardware cursor via curs_set(0) if it overlaps + the popup? Optimizations: * Use SC_DOCUMENTOPTION_STYLES_NONE in batch mode. diff --git a/configure.ac b/configure.ac index 5ac7aad..ed5e056 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.65]) -AC_INIT([SciTECO], [2.5.0], +AC_INIT([SciTECO], [2.5.1], [hackers@fmsbw.de], [sciteco], [https://sciteco.fmsbw.de/]) @@ -334,6 +334,8 @@ case $INTERFACE in xcurses) AC_CHECK_PROG(XCURSES_CONFIG, xcurses-config, xcurses-config) + # NOTE: `xcurses-config --cflags` is expected to set + # -DPDC_WIDE and -DPDC_FORCE_UTF8 (if these features are enabled). if [[ "x$CURSES_CFLAGS" = "x" -a "x$XCURSES_CONFIG" != "x" ]]; then CURSES_CFLAGS=`$XCURSES_CONFIG --cflags` fi @@ -353,6 +355,10 @@ case $INTERFACE in # It is crucial to define XCURSES before including curses.h. AC_DEFINE(XCURSES, 1, [Enable PDCurses/XCurses extensions]) + AC_CHECK_FUNC([has_mouse], [ + AC_DEFINE(PDC_NCMOUSE, 1, [PDCurses built with ncurses mouse API]) + ]) + AC_DEFINE(PDCURSES_GUI, 1, [PDCurses with GUI window]) ;; @@ -452,7 +458,13 @@ AC_ARG_ENABLE(malloc-replacement, [Replace the libc malloc() [default=check]]), [malloc_replacement=$enableval], [malloc_replacement=check]) if [[ $malloc_replacement = check ]]; then - # We currently do not support dlmalloc on Windows and Mac OS. + # malloc() replacement via dlmalloc should work practically everywhere + # but does not extend to shared libraries on Windows and Mac OS. + # That's why it is disabled by default on Windows and Mac OS where other cheap ways + # of introspection are available (see memory.c). + # On the remaining platforms you can try to combine --enable-malloc-replacement + # with --enable-static-executables to link in as many libraries statically + # as possible. case $host in *-*-darwin* | *-mingw*) malloc_replacement=no;; *) malloc_replacement=yes;; diff --git a/contrib/scinterm b/contrib/scinterm -Subproject 53eb713af10abf46f250746a4acc336b16b02f3 +Subproject 26f5d3f5290a2910e44dec16d05da2db33c1272 diff --git a/debian/changelog b/debian/changelog index 0923f61..ddea47c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +sciteco (2.5.1) unstable; urgency=low + + * new upstream version v2.5.1 + + -- Robin Haberkorn <rhaberkorn@fmsbw.de> Sat, 10 Jan 2026 15:16:39 +0000 + sciteco (2.5.0-0) unstable; urgency=low * new upstream version v2.5.0 diff --git a/doc/cheat-sheet.mm b/doc/cheat-sheet.mm index ba7247c..9a63f4e 100644 --- a/doc/cheat-sheet.mm +++ b/doc/cheat-sheet.mm @@ -825,7 +825,12 @@ Binary negate \fIn\fP \(em negate TECO boolean. . TD . CI "" n = . TD -Show value of \fIn\fP in message line. +Show value of \fIn\fP in message line (decimal). +. TRX +. TD +. CI "" n === +. TD +Show value of \fIn\fP in message line (hexadecimal). . TRX . TD colspan=2 Q-Registers consist of 2 cells: strings and integers. diff --git a/freebsd/Makefile b/freebsd/Makefile index 1dcd194..e18b7bc 100644 --- a/freebsd/Makefile +++ b/freebsd/Makefile @@ -1,5 +1,5 @@ PORTNAME= sciteco -DISTVERSION= 2.5.0 +DISTVERSION= 2.5.1 CATEGORIES= editors textproc devel MASTER_SITES= https://sciteco.fmsbw.de/downloads/v${DISTVERSION}/ \ SOURCEFORGE/${PORTNAME}/v${DISTVERSION}/ diff --git a/src/core-commands.c b/src/core-commands.c index f81bdf3..cd9a8fa 100644 --- a/src/core-commands.c +++ b/src/core-commands.c @@ -1983,7 +1983,7 @@ TECO_DEFINE_STATE_COMMAND(teco_state_ctlc_control, * Without any argument ED returns the current flags. * * Currently, the following flags are used by \*(ST: - * .IP 2: 5 + * .IP 2: 6 * Reflects whether program termination has been requested * by successfully performing the \fBEX\fP command. * This flag can also be used to cancel the effect of any diff --git a/src/interface-curses/interface.c b/src/interface-curses/interface.c index 0764db3..94501cb 100644 --- a/src/interface-curses/interface.c +++ b/src/interface-curses/interface.c @@ -278,8 +278,8 @@ teco_color_attr(gshort fg, gshort bg) * Basic support for monochrome terminals: * Every background, that is not black is assumed to be a * dark-on-bright area, rendered in reverse. - * This will at least work with the terminal.tes - * color scheme. + * This will at least work with the terminal.tes and contrast.tes + * color schemes. */ return bg != COLOR_BLACK ? A_REVERSE : 0; } @@ -395,6 +395,13 @@ teco_view_noutrefresh(teco_view_t *ctx) scintilla_noutrefresh(ctx); } +static inline void +teco_view_update_cursor(teco_view_t *ctx) +{ + if (teco_view_ssm(ctx, SCI_GETCARETSTYLE, 0, 0) & CARETSTYLE_CURSES) + scintilla_update_cursor(ctx); +} + static inline WINDOW * teco_view_get_window(teco_view_t *ctx) { @@ -445,6 +452,10 @@ teco_interface_init(void) * Instead we use INDIC_SQUIGGLE, which is rendered as A_UNDERLINE. */ teco_cmdline_ssm(SCI_INDICSETSTYLE, INDICATOR_RUBBEDOUT, INDIC_SQUIGGLE); + /* + * Enable hardware cursor by default. + */ + teco_cmdline_ssm(SCI_SETCARETSTYLE, CARETSTYLE_CURSES, 0); /* * On all platforms except Curses/XTerm, it's @@ -784,8 +795,6 @@ teco_interface_init_interactive(GError **error) cbreak(); noecho(); - /* Scintilla draws its own cursor */ - curs_set(0); /* * This has also been observed to reduce flickering * in teco_interface_refresh(). @@ -1229,7 +1238,20 @@ teco_interface_info_update_buffer(const teco_buffer_t *buffer) * default clipboard ("~") as we do not know whether * it corresponds to the X11 PRIMARY, SECONDARY or * CLIPBOARD selections. + * + * On XCurses we must not (and don't have to) probe + * the clipboard as it would be before Xinitscr(). */ +#ifdef XCURSES + +static void +teco_interface_init_clipboard(void) +{ + teco_qreg_table_replace(&teco_qreg_table_globals, teco_qreg_clipboard_new("")); +} + +#else /* XCURSES */ + static void teco_interface_init_clipboard(void) { @@ -1254,6 +1276,8 @@ teco_interface_init_clipboard(void) teco_qreg_table_replace(&teco_qreg_table_globals, teco_qreg_clipboard_new("")); } +#endif /* !XCURSES */ + gboolean teco_interface_set_clipboard(const gchar *name, const gchar *str, gsize str_len, GError **error) { @@ -1813,6 +1837,16 @@ teco_interface_refresh(gboolean force) clearok(curscr, TRUE); /* + * Let Scinterm enable/disable the hardware cursor + * based on the CARETSTYLE_CURSES. + * Doing this repeatedly ensures you can change the + * caret style interactively. + * Also, window resizes enable the cursor on PDCurses/wincon + * sometimes (FIXME). + */ + curs_set(0); + + /* * Info window is updated very often which is very * costly, especially when using PDC_set_title(), * so we redraw it here, where the overhead does @@ -1824,6 +1858,17 @@ teco_interface_refresh(gboolean force) wnoutrefresh(teco_interface.msg_window); teco_view_noutrefresh(teco_cmdline.view); teco_curses_info_popup_noutrefresh(&teco_interface.popup); + /* + * If hardware cursors (CARETSTYLE_CURSES) are enabled on the + * command-line view, make sure that the cursor is left + * in the correct position. + * + * FIXME: This shouldn't be necessary if we refreshed the command-line + * view last. Also, if we wanted to support the hardware cursor + * in the main view as well, we'd have to handle a possibly + * overlappig info popup. + */ + teco_view_update_cursor(teco_cmdline.view); doupdate(); } @@ -2016,7 +2061,8 @@ teco_interface_blocking_getch(void) gboolean new_mousekey = (teco_ed & TECO_ED_MOUSEKEY) != 0; if (new_mousekey != old_mousekey) { old_mousekey = new_mousekey; - mmask_t mmask = BUTTON_EVENT(PRESSED) | BUTTON_EVENT(RELEASED); + mmask_t mmask = BUTTON_EVENT(PRESSED) | BUTTON_EVENT(RELEASED) | + BUTTON_SHIFT | BUTTON_CTRL | BUTTON_ALT; #ifdef __PDCURSES__ /* * On PDCurses it's crucial NOT to mask for BUTTONX_CLICKED. @@ -2099,11 +2145,6 @@ teco_interface_event_loop_iter(void) return; #ifdef KEY_RESIZE case KEY_RESIZE: - /* - * At least on PDCurses/Wincon, the hardware cursor is sometimes - * reactivated. - */ - curs_set(0); teco_interface_resize_all_windows(); break; #endif diff --git a/src/interface-gtk/gtk-info-popup.c b/src/interface-gtk/gtk-info-popup.c index 769f772..f2c8dc8 100644 --- a/src/interface-gtk/gtk-info-popup.c +++ b/src/interface-gtk/gtk-info-popup.c @@ -30,6 +30,8 @@ #include "gtk-label.h" #include "gtk-info-popup.h" +#define TECO_UNNAMED_FILE "(Unnamed)" + /* * FIXME: This is redundant with curses-info-popup.c. */ @@ -336,7 +338,7 @@ teco_gtk_info_popup_idle_add(TecoGtkInfoPopup *self, teco_popup_entry_type_t typ } } - GtkWidget *label = teco_gtk_label_new(name, len); + GtkWidget *label = teco_gtk_label_new(name, len, TECO_UNNAMED_FILE); /* * Gtk v3.20 changed the CSS element names. * Adding a style class eases writing a portable fallback.css. diff --git a/src/interface-gtk/gtk-label.c b/src/interface-gtk/gtk-label.c index 5052cdc..6e05045 100644 --- a/src/interface-gtk/gtk-label.c +++ b/src/interface-gtk/gtk-label.c @@ -32,8 +32,6 @@ #include "gtk-label.h" -#define TECO_UNNAMED_FILE "(Unnamed)" - #define GDK_TO_PANGO_COLOR(X) ((guint16)((X) * G_MAXUINT16)) struct _TecoGtkLabel { @@ -42,8 +40,10 @@ struct _TecoGtkLabel { PangoColor fg, bg; guint16 fg_alpha, bg_alpha; - /** text backing the label or empty string for "(Unnamed)" buffer */ + /** text backing the label or empty string for fallback */ teco_string_t string; + /** fallback string to render if `string` is empty or NULL */ + const gchar *fallback; }; G_DEFINE_TYPE(TecoGtkLabel, teco_gtk_label, GTK_TYPE_LABEL) @@ -125,11 +125,21 @@ teco_gtk_label_class_init(TecoGtkLabelClass *klass) static void teco_gtk_label_init(TecoGtkLabel *self) {} +/** + * Create new TECO label widget. + * + * @param str String to render (can be NULL) + * @param len Length of str or negative value for null-terminated strings. + * @param fallback Null-terminated fallback string to render + * instead of empty strings. + * Must be a string constant with global lifetime or NULL. + */ GtkWidget * -teco_gtk_label_new(const gchar *str, gssize len) +teco_gtk_label_new(const gchar *str, gssize len, const gchar *fallback) { TecoGtkLabel *widget = TECO_GTK_LABEL(g_object_new(TECO_TYPE_GTK_LABEL, NULL)); + widget->fallback = fallback; teco_gtk_label_set_text(widget, str, len); return GTK_WIDGET(widget); @@ -255,8 +265,8 @@ teco_gtk_label_set_text(TecoGtkLabel *self, const gchar *str, gssize len) teco_string_init(&self->string, str, len < 0 ? strlen(str) : len); teco_string_t string = self->string; - if (!string.len) { - string.data = TECO_UNNAMED_FILE; + if (!string.len && self->fallback) { + string.data = (gchar *)self->fallback; string.len = strlen(string.data); } diff --git a/src/interface-gtk/gtk-label.h b/src/interface-gtk/gtk-label.h index ad39c6e..a84608a 100644 --- a/src/interface-gtk/gtk-label.h +++ b/src/interface-gtk/gtk-label.h @@ -24,7 +24,7 @@ #define TECO_TYPE_GTK_LABEL teco_gtk_label_get_type() G_DECLARE_FINAL_TYPE(TecoGtkLabel, teco_gtk_label, TECO, GTK_LABEL, GtkLabel) -GtkWidget *teco_gtk_label_new(const gchar *str, gssize len); +GtkWidget *teco_gtk_label_new(const gchar *str, gssize len, const gchar *fallback); void teco_gtk_label_set_text(TecoGtkLabel *self, const gchar *str, gssize len); teco_string_t teco_gtk_label_get_text(TecoGtkLabel *self); diff --git a/src/interface-gtk/interface.c b/src/interface-gtk/interface.c index 0e1507f..ace3a2f 100644 --- a/src/interface-gtk/interface.c +++ b/src/interface-gtk/interface.c @@ -202,7 +202,7 @@ teco_interface_init(void) */ teco_interface.info_bar_widget = gtk_header_bar_new(); gtk_widget_set_name(teco_interface.info_bar_widget, "sciteco-info-bar"); - teco_interface.info_name_widget = teco_gtk_label_new("", 0); + teco_interface.info_name_widget = teco_gtk_label_new(NULL, 0, NULL); gtk_widget_set_valign(teco_interface.info_name_widget, GTK_ALIGN_CENTER); /* eases writing portable fallback.css that avoids CSS element names */ gtk_style_context_add_class(gtk_widget_get_style_context(teco_interface.info_name_widget), @@ -288,7 +288,7 @@ teco_interface_init(void) gtk_widget_set_name(teco_interface.message_bar_widget, "sciteco-message-bar"); GtkWidget *message_bar_content = gtk_info_bar_get_content_area(GTK_INFO_BAR(teco_interface.message_bar_widget)); - teco_interface.message_widget = teco_gtk_label_new(NULL, 0); + teco_interface.message_widget = teco_gtk_label_new(NULL, 0, NULL); /* eases writing portable fallback.css that avoids CSS element names */ gtk_style_context_add_class(gtk_widget_get_style_context(teco_interface.message_widget), "label"); diff --git a/tests/atlocal.in b/tests/atlocal.in index b2ceda1..81dc1fb 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -40,4 +40,4 @@ esac # Default stack size on Linux (8M). # Some platforms allow very large stack sizes, making it hard to test # against potential stack overflows. -ulimit -s 8192 +ulimit -s 8192 || true diff --git a/www/screenshots.md b/www/screenshots.md index df8925a..471374e 100644 --- a/www/screenshots.md +++ b/www/screenshots.md @@ -1,5 +1,9 @@ # Screenshots +## v2.5.1 + + + ## v2.4.0  |
