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).
P2 selects how the terminal draws the background color.
P2 Meaning
0 or 2 (default) Pixel positions specified as 0 are set to the
current background color.
1 Pixel positions specified as 0 remain at their
current color.
Both modes are now supported.
Ref. https://www.vt100.net/docs/vt3xx-gp/chapter14.html
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
* 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.
ref.
https://git.suckless.org/st/commit/8629d9a1da72cc18568a8f146307b0e939b77ebf.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
* sixel: remove black bars from sixel images
When the images don't fully cover the text cells, black bars are added
to them. This fix removes those bars, but if you need the old behavior,
you can restore it by setting 'sixelremovebars' to zero in config.h
* sixel: fix a potential memory leak
* sixel: improve behavior with text reflow
* sixel: prevent animated gifs from choking the terminal
Animated gifs constantly spawn new images that eventually choke the
terminal because the old animation frames are kept in the image buffer.
This fix removes overlapping images from the image buffer and prevents
them from piling up.
* sixel: add zooming and clipping
* sixel: copying bulk of changes
* sixel: move sixel_parser_parse() and add missing sequences and blocks (#113)
- Move sixel_parser_parse() from tputc() to twrite()
- Add missing 8452, DECSDM, XTSMGRAPHICS and XTWINOPS sequences
- Add more conditional blocks for the scrollback and sync patches
- Remove unused reflow_y from ImageList. It is only used for the
scrollback-reflow patch in st-sx.
* sixel: update vtiden to VT200 family
* sixel: fix scrolling issues inside tmux (#114)
tmux is using the scrolling region and sequence to clear the screen
below the shell prompt. This peculiar behavior caused the tscrollup()
function to be called, which always scrolled the images regardless of
whether they were inside the region or not. So the images moved out of
place whenever the bottom of the screen was cleared. This fix checks
that the images are inside the region before scrolling them.
* sixel: prevent images from being deleted when resizing (#115)
This fixes resizing issues outside of tmux not inside.
* Rewriting tresize logic based on veltza's proposed implementation in PR #115
* tresize: correction for tscrollup call when scrollback patch is used
---------
Co-authored-by: veltza <106755522+veltza@users.noreply.github.com>
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
...support for transparency. Technically, the sixels do not have transparency,
but empty pixels are now rendered with the current background color instead
of black to make the them appear transparent. Same goes for the black bars.
The current background color makes them disappear.
There is one technical limitation with the alpha focus highlight patch.
The alpha value and background color is taken from the current background color,
so when the window is unfocused, images may have the wrong alpha and/or
background color. This can't be fixed easily.
It is unclear if it's "required" to do this on RIS, but it's useful when
calling reset(1) after interactive programs have crashed and garbled up
the screen.
FWIW, other terminals do it as well (tested with XTerm, VTE, Kitty,
Alacritty, Linux VT).
ref.
https://git.suckless.org/st/commit/559fdc278681c98470749adb59f01cd071720458.html
Consider the following example:
printf '\e[?7l';\
for i in $(seq $(($(tput cols) - 1))); do printf a; done;\
printf '🙈\n';\
printf '\e[?7h'
Even though MODE_WRAP has been disabled, the emoji appeared on the next
line. This patch keeps wide glyphs on the same line and moves them to
the right-most possible position.
ref.
https://git.suckless.org/st/commit/8abe4bcb41aa7fda0ae00823f6a20271124150db.html
Fixes garbage selections when switching to/from the alternate screen.
How to reproduce:
- Be in primary screen.
- Select something.
- Run this (switches to alternate screen, positions the cursor at the
bottom, triggers selscroll(), and then goes back to primary screen):
tput smcup; tput cup $(tput lines) 0; echo foo; tput rmcup
- Notice how the (visual) selection now covers a different line.
The reason is that selscroll() calls selnormalize() and that cannot find
the original range anymore. It's all empty lines now, so it snaps to
"select the whole line".
ref.
https://git.suckless.org/st/commit/2fc7e532b23e2f820c6b73d352ec7c41fefa45b5.html
dc.collen is the length of dc.col, not the maximum index, hence if x is
equal to dc.collen, then it's an error.
With config.def.h, the last valid index is 259, so this correctly
reports "black":
$ printf '\033]4;259;?\e\\'
260 is an invalid index and this reports garbage instead of printing an
error:
$ printf '\033]4;260;?\e\\'
ref.
https://git.suckless.org/st/commit/a6bbc0c96b0a1db804061b0db79101c6b26aec57.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