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
This patch fixes the following sixel issues:
- The current sixel implementation cleared all cells from the left side
of the image when the image was drawn. The fix only clears the cells
where the image will be drawn.
- The deletion routine didn't work correctly. In certain situations,
it left the image or images undrawn. For example, if the first image
was marked for deletion, it didn't draw the second one.
- The drawing routine caused a high cpu usage, because XCopyArea()
triggered the X server to send the NoExpose event, which caused sixels
to be redrawn and the X server to send another NoExpose event and so
on. This loop caused constant redraw of sixels and high cpu usage.
The fix prevents the X server from sending GraphicsExpose and NoExpose
events.
The patch also adds a control sequence for removing sixels:
Because the sixels are implemented as overlay images, they cannot be
removed by clearing the underlaying cells. Therefore, we need a control
sequence to remove them. I opted to choose ESC[6J as the control
sequence because it is not used and the number refers to sixels. So when
the lf file manager supports sixels [1], you can use the following
minimal scripts to preview images in lf:
previewer:
#!/bin/sh
case "$(readlink -f "$1")" in
*.bmp|*.gif|*.jpg|*.jpeg|*.png|*.webp|*.six|*.svg|*.xpm)
chafa -s "$(($2-3))x$3" -f sixels "$1"
exit 1 ;;
*)
bat "$1" ;;
esac
cleaner:
#!/bin/sh
printf "\033[6J" >/dev/tty
[1] https://github.com/gokcehan/lf/pull/1211
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
Add support for DSR response "OK" escape sequence
"VT100 defines an escape sequence [1] called Device Status Report (DSR). When
the DSR sequence received is `csi 5n`, an "OK" response `csi 0n` is returned.
This patch adds that "OK" response.
I encountered this missing sequence when I noticed that fzf [2] would clobber
my prompt whenever completing a find.
To test that ST doesn't currently respond to `csi 5n`, use fzf's shell
extension in ST's repo to complete the path for a file.
my-fancy-prompt $ vim **<tab>
<select a file>
st.c
Select a file with <enter>, and notice that fzf clobbers some or all of your
prompt.
After applying this patch, do the same test as above and notice that fzf has no
longer clobbered your prompt by placing the file name in the correct position
in your command.
my-fancy-prompt $ vim **<tab>
<select a file>
my-fancy prompt $ vim st.c
Thank you for considering my first patch submission.
[1] https://www.xfree86.org/current/ctlseqs.html#VT100%20Mode
[2] https://github.com/junegunn/fzf
"
Patch slightly adapted with input from the mailinglist,
Ref.
https://git.suckless.org/st/commit/f17abd25b376c292f783062ecf821453eaa9cc4c.html
Fixed OSC color reset without parameter->resets all colors
Adapted from (garbled) patch by wim <wim@thinkerwim.org>
Additional notes: it should reset all the colors using xloadcols().
To reproduce: set a different (theme) color using some escape code, then reset
it:
printf '\x1b]104\x07'
Ref.
https://git.suckless.org/st/commit/7e8050cc621f27002eaf1be8114dee2497beff91.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
Scrolling back and then entering keyboardselect's copy mode causes
glitched text to appear when moving the cursor. This is because the
keyboardselect patch is not aware of the scrollback history (term.hist),
so it takes the text from the last displayed screen (term.line).
Co-authored-by: Àlex Ramírez <aramirez@verbio.com>
This patch 1) improves reloading X resources - by considering fonts in
a way nearly identical to function `zoomabs`' - and 2) re-renders st so
that changed colors and fonts can be seen.
* fix externalpipein patch
don't close the slave fd, according to the original patch in
https://lists.suckless.org/hackers/2004/17218.html
* externalpipein patch: add example command
press S-C-M to set the terminal background green dynamically.
Replace `printf ...` with `dynamic-colors cycle` command mentioned in
https://lists.suckless.org/hackers/2004/17218.html to cycle though the
available dynamic color themes.
The openurlonclick and scrollback patches are now working together,
so links can be clicked in the scrollback buffer too. This update also
adds url underlining and other improvements to the openurlonclick patch.
The full list of changes in the openurlonclick patch:
- Adds scrollback support
- Adds modkey option
- Better url detection
- Underlines url when the mouse pointer is over a link
- Opens a browser as a background process, so it won't lock the terminal anymore
- Fixes a segmentation fault bug
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