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.
Ref.
- https://git.suckless.org/st/commit/ea7cd7b62fdfa6a1fbd882d1565d557577f2cf32.html
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:
#!/bin/sh
alias printf=/usr/bin/printf
printf こんにちは!; sleep 2
printf '\x1b[5D'; sleep 2
printf へ; sleep 2
printf ' '; sleep 2
echo
Ref.
- https://git.suckless.org/st/commit/65f1dc428315ae9d7f362e10c668557c1379e7af.html
Tested with and without alpha patch applied. Simply setting alpha to 255
seems to fix it. I didn't set `dst` on lines 263 and 273 because those
loops are impossible to reach.
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
In the current implementation, the slave PTY (assigned to the variable
`s') is always closed after duplicating it to file descriptors of
standard streams (0, 1, and 2). However, when the allocated slave PTY
`s' is already one of 0, 1, or 2, this causes unexpected closing of a
standard stream. The same problem occurs when the file descriptor of
the master PTY (the variable `m') is one of 0, 1, or 2.
In this patch, the original master PTY (m) is closed before it would
be overwritten by duplicated slave PTYs. The original slave PTY (s)
is closed only when it is not one of the standarad streams.
Ref. https://git.suckless.org/st/commit/1d3142da968da7f6f61f1c1708f39ca233eda150.html
#if SIXEL_PATCH
case 't':
/* TODO should probably not be hard-coded */
ttywrite(";420;720t", 10, 1);
break;
#endif // SIXEL_PATCH
This would result in printing ";420;720t" when exiting neovim.
Without this code a line is written to standard err instead:
erresc: unknown csi ESC[23;0t
The ttywrite was added as part of this commit:
- b50be8225d
which states:
> When a S or T CSI escape was encountered, the lines which were scrolled
> away would be deleted from the scrollback buffer. This has been
> corrected - the lines are now preseved.
>
> This fixes a bug where issuing `clear` followed by `lsix` would cause
> the line on which the `lsix` was issued to disappear from the scrollback
> buffer.
>
> Note that the line may scroll out of view and thus dissapear, but it
> will now be preserved in the scrollback buffer.
Given that we could not reproduce the above bug without the ttywrite in
this case I am not convinced that this is actually needed. Leaving this
here in case this comes up again in the future.
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.
There is a compatibility issue between the dwm swallow patch and the
newterm patch for st.
The swallow patch identifies the terminal client to substitute by
traversing the process tree checking if the new window is a descendant
of a terminal client.
The newterm patch for st spawns a new terminal that is a descendant of
the parent st process.
This can lead to situations where the swallow patch ends up replacing
the wrong terminal window.
Changed the forking mechanism to do a double fork and letting the
first one die. This is a technique commonly used by daemons to spawn
new orphan processes.
If the mouse cursor is changed to a bar or an underline then st will use that
when the terminal is first opened. When an application that changes the cursor
via escape sequences is executed, e.g. vim which uses a block cursor by default,
then that cursor will remain after exiting the program.
This change sets the cursor back to default when exiting alt mode.