Commit Graph

93 Commits

Author SHA1 Message Date
veltza 677f854c05
Fix sixel issues and add a clearing sequence (#99)
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
2023-06-12 16:02:19 +02:00
Bakkeby bd370228a4 ligatures: upgrading patch 2022-12-19 10:14:14 +01:00
Bakkeby e6a2fb489c Bump to e5e9598.
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
2022-10-25 17:22:33 +02:00
Bakkeby d8529b66a4 Adding fullscreen patch ref. #88 2022-10-24 11:27:51 +02:00
Bakkeby 35b7da0919 alpha focus highlight: upgrade patch to latest (20200731-43a395a) 2022-10-06 13:20:27 +02:00
Bakkeby 34cd955f14 Adding key and mouse binding option to control whether they apply to primary screen, alt screen or both ref. #81 2022-09-01 22:01:20 +02:00
Bakkeby 2906447fef Adding use XftFontMatch patch 2022-08-28 21:05:55 +02:00
Bakkeby 3947ceb431 Adding the no window decorations patch 2022-08-24 11:04:49 +02:00
Bakkeby bcfa5b9b7f wide glyphs: adding alternative patch ref. #56 2022-08-11 15:56:42 +02:00
veltza 3eb170a9a5 Add scrollback support to the openurlonclick patch
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
2022-08-10 21:32:44 +03:00
Bakkeby f0bad9ac44 Removing the anysize-nobar amendment for the anysize patch as this should be redundant following the fix in PR #75 2022-07-18 11:54:51 +02:00
veltza f4b32e05a1 Fix border issues in the anysize patch 2022-07-16 23:35:27 +03:00
veltza 2e6ffa28f4 Fix flickering when sixel images are moving 2022-06-08 00:51:58 +03:00
bakkeby 3e41e252b1 Adding background image reload patch ref. pull request #62 2022-04-11 16:04:58 +02:00
bakkeby fb0b76b0ff make underlines and strikethroughs respect `chscale`
Ref.
https://git.suckless.org/st/commit/2aefa348baf4b702fdce98eb105bcba175d8283f.html
2022-03-14 09:45:12 +01:00
bakkeby 1a8175a337 Adding background image patch 2022-03-10 13:54:28 +01:00
bakkeby cc4595779d X10/SGR mouse: use alt as meta key instead of super/windows key
Ref.
   - https://git.suckless.org/st/commit/2c5edf28ec851907305d73c6218ce75d39f1767f.html
2022-02-24 13:39:56 +01:00
bakkeby 5bf86e1ca2 Fix mousereport
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
2022-02-24 13:38:01 +01:00
bakkeby 9ab02993c3 Add support for OSC color sequences
Ref.
  - https://git.suckless.org/st/commit/8e310303903792c010d03c046ba75f8b18f7d3a7.html
  - https://git.suckless.org/st/commit/273db5ceaf392e68c2faf8f7dec14ea2e25e980d.html
2022-02-24 13:24:00 +01:00
bakkeby 7099c6ec73 sixel: adding anysize patch compatibility ref. #45 2021-12-15 11:23:59 +01:00
bakkeby c02ad97409 fix possible rare crash when Xutf8TextPropertyToTextList fails
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
2021-08-24 15:02:20 +02:00
bakkeby f0e4dc3bd5 undercurl: upgrading patch with curly, spiky and capped options
Ref. https://git.suckless.org/sites/commit/9bb304a974185cbd9fa48c890450c6582d3e0546.html
2021-08-22 18:35:31 +02:00
bakkeby 271a807111 Adding the CSI 22, 23 patch 2021-08-18 10:07:42 +02:00
bakkeby d50ebeef66 dynamic cursor color: trying out JuanScerriE's proposed amendment for the patch ref. #10 2021-07-29 18:45:11 +02:00
bakkeby f643835542 Adding simple version of the anysize patch ref. #35 2021-07-29 12:22:44 +02:00
bakkeby 286db8098b Add 14th bit to XK_SWITCH_MOD bitmask
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.
2021-07-18 18:17:17 +02:00
bakkeby ee4cdc8d6e Adding openurlonclick patch ref. #32 2021-07-07 10:08:43 +02:00
bakkeby 426eca8f2e Adding proposed scrollback changes for sixel graphics ref. #30 2021-07-07 09:43:43 +02:00
bakkeby b0660ecf47 Adding hide terminal cursor patch 2021-06-09 09:54:50 +02:00
bakkeby ad7e16b38a Adding swapmouse patch ref. #28 2021-05-16 11:40:15 +02:00
bakkeby 56931acefb Proposed fix for wide glyphs ref. #26 2021-05-15 09:16:51 +02:00
bakkeby 5adf4c4c8e Adding default cursor patch 2021-05-11 16:35:30 +02:00
bakkeby 2d59f21271 Revert "Restore cursor when exiting alt mode."
This reverts commit 52900255d9.
2021-05-11 15:42:47 +02:00
bakkeby 52900255d9 Restore cursor when exiting alt mode.
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.
2021-05-11 10:12:23 +02:00
bakkeby 72ee5f3307 vim-browse: fix for missing history overlay 2021-05-10 10:43:38 +02:00
bakkeby 763e9f15b3 Mild const-correctness improvements.
Only touch a few things, the main focus is to
improve code readability.

https://git.suckless.org/st/commit/4536f46cfff50c66a115755def0155d8e246b02f.html
2021-05-10 09:35:50 +02:00
bakkeby 29b20b54c5 ST: Add WM_ICON_NAME property support
Also added _NET_WM_ICON_NAME.

https://git.suckless.org/st/commit/28b4c822c5c0acec300fdf15c6e3ede9f5e2335d.html#h0-1-11
https://git.suckless.org/st/commit/4ef0cbd8b9371f37f7d02ef37b5378b879e6b8bf.html#h0-0-3
2021-05-10 09:28:15 +02:00
bakkeby 835d204593 fix: correctly encode mouse buttons >= 8 in X10 and SGR mode
These are typically mapped in X11 to the side-buttons (backward/forwards) on
the mouse. A comparison of the button numbers in SGR mode (first field):

st old:
0 1 2 64 65 66 67 68 69 70

st new (it is the same as xterm now):
0 1 2 64 65 66 67 128 129 130

A script to test and reproduce it, first argument is "h" (on) or "l" (off):

	#!/bin/sh
	printf '\x1b[?1000%s\x1b[?1006%s' "$1" "$1"

	for n in 1 2 3 4 5 6 7 8 9 10; do
		printf 'button %d\n' "$n"
		xdotool click "$n"
		printf '\n\n'
	done

https://git.suckless.org/st/commit/9e68fdbcdb06dfa3d23fe3a7a7f7b59e40e1ea2f.html
2021-05-10 09:22:32 +02:00
bakkeby 0325f7c76b vim-browse: segment fault when applied on top of st-clipboard patch ref. #21 2021-05-09 19:53:25 +02:00
bakkeby e039854635 Adding vim browse patch ref. #21 2021-05-09 17:48:28 +02:00
bakkeby 1a1d492cd8 Adding alpha-focus-highlight patch 2021-05-09 14:40:30 +02:00
bakkeby 56e208e0de Adding sync patch ref. #21 2021-05-09 09:25:22 +02:00
bakkeby a5435903d4 Adding universcroll patch ref. #21 2021-05-08 17:49:04 +02:00
bakkeby 8c8bace91c Adding netwmicon patch ref. #21 2021-05-08 14:50:06 +02:00
bakkeby 79278e3d32 Adding undercurl patch ref. #20 2021-05-08 10:53:46 +02:00
bakkeby ce05a34de1 Adding blinking cursor patch ref. #20 2021-05-08 10:13:20 +02:00
bakkeby 0fade9158a xresources reload: minor style changes ref. #16 2021-05-07 09:27:05 +02:00
Loic Coyle 540a923fb9 Add XRESOURCES_RELOAD_PATCH 2021-04-24 00:30:14 +02:00
Loic Coyle ec513b230a Add alpha to background color from escape sequence 2021-04-22 20:49:05 +02:00
bakkeby 08f137a8a0 Adding workaround for Variable Fonts causing too wide letter spacing 2021-04-21 15:54:41 +02:00