Applied alpha patch and config colors
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> :
Reported by and an initial patch by Andy Gozas <email@example.com>, 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.
st: use `void' to indicate an empty parameter list
Makefile: add manual path for OpenBSD
code-golfing: cleanup osc color related code
* adds missing function prototype
* move xgetcolor() prototype to win.h (that's where all the other x.c
func prototype seems to be declared at)
* check for snprintf error/truncation
* reduces code duplication for osc 10/11/12
* unify osc_color_response() and osc4_color_response() into a single function
the latter two was suggested by Quentin Rameau in his patch review on
the hackers list.
base64_digits: reduce scope, implicit zero, +1 size
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
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.
avoid potential UB when using isprint()
all the ctype.h functions' argument must be representable as an unsigned
char or as EOF, otherwise the behavior is undefined.
make underlines and strikethroughs respect `chscale`
Delay redrawals on palette changes
Build on auto-sync and only mark window dirty on palette changes and let
the event handler do the actual draw.
X10/SGR mouse: use alt as meta key instead of super/windows key
This patch replaces the previous one I sent.
The following changes are made in this patch:
- Fix tracking of pressed buttons. Previously, pressing two buttons and
then releasing one would make st think no buttons are pressed, which
in particular broke MODE_MOUSEMOTION.
- Always send the lowest-numbered pressed button on motion events; when
no button is pressed for a motion event in MODE_MOUSEMANY, then send
a release. This matches the behaviour of xterm. (Previously, st sent
the most recently pressed button in the motion report.)
- Remove UB (?) access to potentially inactive struct member
e->xbutton.button of XEvent union.
- Fix (unlikely) possibility of overflow for large button numbers.
The one discrepancy I found between st and xterm is that xterm sometimes
encodes buttons with large numbers (>5) strangely. E.g., xterm reports
presses of buttons 8 and 9 as releases, whereas st properly (?) encodes
them as presses.
FAQ: fix a typo, patch -> path
Fix overtyping wide characters.
Overtyping the first half of a wide character with the
second half of a wide character results in display garbage.
This is because the trailing dummy is not cleaned up.
i.e. ATTR_WIDE, ATTR_WDUMMY, ATTR_WDUMMY
Here is a short script for demonstrating the behavior:
printf こんにちは！; sleep 2
printf '\x1b[5D'; sleep 2
printf へ; sleep 2
printf ' '; sleep 2
Fix null pointer access in strhandle
According to the spec the argument is optional for 104, so p can be
NULL as can be tested with printf '\x1b]104\x07'. This is a regression