Patch by Mikhail Kot <to@myrrc.dev>
With some modifications to behave more like xterm (see note below).
Example:
printf '\033[48;2;255:0:0mtest\n'
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
Some notes:
"CSI Pm m Character Attributes (SGR).
[...]
o xterm allows either colons (standard) or semicolons
(legacy) to separate the subparameters (but after the
first colon, colons must be used).
With this patch, st will reset its window title when an empty string is
given as the terminal title. For example:
printf "\033]0;\007"
Some applications, like termdown, expect this functionality. xterm
implements it, but it seems that most other terminal emulators don't.
In any case, I don't see why there should ever be a case where the st
window doesn't have a title property.
Ref.
https://git.suckless.org/st/commit/497a75638291454875ba1ec8d484c7f3d6f41d66.html
The general reasoning is that the vim browse patch is very invasive,
has a high level of complexity, and is incompatible with a significant
number of other patches and it complicates further maintenance.
Additionally the patch has its own scrollback mechanism which seemingly
did not work properly - and nobody seems to have complained about this
since the patch was added back in May 2021.
If you want to try out the vim browse patch then I would recommend having
a play around with the patch author's own build that has this patch
integrated:
- https://github.com/juliusHuelsmann/st-history-vim
- https://github.com/juliusHuelsmann/st
Alternatively a tag has been added to this repository that refers to the
last commit that still has the vim browse patch:
- https://github.com/bakkeby/st-flexipatch/tree/VIM_BROWSE_PATCH
The handler for 'S' final character does not check for a private
marker. This can cause a conflict with a sequence called 'XTSMGRAPHICS'
which also has an 'S' final character, but uses the private marker '?'.
Without checking for a private marker, st will perform a scroll up
operation when XTSMGRAPHICS is seen, which can cause unexpected display
artifacts.
ref.
https://git.suckless.org/st/commit/a3f7420310be0fd778ef9fe2abf20edc2d8dc81a.html
The Makefile used to suppress output (by using @), so this target made sense at
the time.
But the Makefile should be simple and make debugging with less abstractions or
fancy printing. The Makefile was made verbose and doesn't hide the build
output, so remove this target.
Prompted by a question on the mailing list about the options target.
ref.
https://git.suckless.org/st/commit/eb3b894f4076f2b25afc644a1f444b5cbd96aae8.html
Under insert mode, when inserting a normal character in front of
a wide character, the affected region is shifted to the right by
one cell. However, the empty cell is reset as if being a part of a
wide character, causing the following cell being mishandled as a
dummy cell.
To reproduce the bug:
printf '\033[4h' # set MODE_INSERT
printf 妳好
printf '\033[4D'
printf 'x'
printf '\033[4l\n'
Ref.
https://git.suckless.org/st/commit/3a6d6d740110e6ee1b092d05ad746244eedabe4b.html
ignore C1 control characters in UTF-8 mode
Ignore processing and printing C1 control characters in UTF-8 mode.
These are in the range: 0x80 - 0x9f.
By default in st the mode is set to UTF-8.
This matches more the behaviour of xterm with the options -u8 or +u8 also.
Also see the xterm resource "allowC1Printable".
Let me know if this breaks something, in most cases I don't think so.
As usual a very good reference is:
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
Ref.
https://git.suckless.org/st/commit/211964d56ee00a7d46e251cbc150afb79138ae37.html
fix buffer overflow when handling long composed input
To reproduce the issue:
"
If you already have the multi-key enabled on your system, then add this line
to your ~/.XCompose file:
[...]
<question> <T> <E> <S> <T> <question> :
"1234567890123456789012345678901234567890123456789012345678901234567890"
"
Reported by and an initial patch by Andy Gozas <andy@gozas.me>, thanks!
Adapted the patch, for now st (like dmenu) handles a fixed amount of composed
characters, or otherwise ignores it. This is done for simplicity sake.
Ref.
https://git.suckless.org/st/commit/e5e959835b195c023d1f685ef4dbbcfc3b5120b2.html
the array is not accessed outside of base64dec() so it makes sense to
limit it's scope to the related function. the static-storage duration of
the array is kept intact.
this also removes unnecessary explicit zeroing from the start and end of
the array. anything that wasn't explicitly zero-ed will now be
implicitly zero-ed instead.
the validity of the new array can be easily confirmed via running this
trivial loop:
for (int i = 0; i < 255; ++i)
assert(base64_digits[i] == base64_digits_old[i]);
lastly, as pointed out by Roberto, the array needs to have 256 elements
in order to able access it as any unsigned char as an index; the
previous array had 255.
however, this array will only be accessed at indexes which are
isprint() || '=' (see `base64dec_getc()`), so reducing the size of the
array to the highest printable ascii char (127 AFAIK) + 1 might also be
a valid strategy.
ref. https://git.suckless.org/st/commit/ef0551932fb162f907b40185d2f48c3b497708ee.html
from the XmbTextListToTextProperty(3) man page:
"If insufficient memory is available for the new value string, the functions
return XNoMemory. If the current locale is not supported, the functions return
XLocaleNotSupported. In both of these error cases, the functions do not set
text_prop_return."
Reported by Steffen Nurpmeso <steffen@sdaoden.eu>, thanks!
Ref. https://git.suckless.org/st/commit/2f6e597ed871cff91c627850d03152cae5f45779.html
The bits of uint signal in an XKeyEvent which concern the key group (keyboard
layout) are bits 13 and 14, as documented here:
https://www.x.org/releases/X11R7.7/doc/libX11/XKB/xkblib.html#Groups_and_Shift_Levels
In the older version, only bit 13 was marked as part of XK_SWITCH_MOD, this
causes issues for users who have more than two keymaps. The 14th bit is not
in ignoremod, key sequences are not caught by match(), if they switch to a third
or fourth keyboard.