Commit Graph

109 Commits

Author SHA1 Message Date
Stein Gunnar Bakkeby 0b8055a271
netwmicon: upgrading patch and adding farbfeld variant (#121) 2024-03-13 10:35:17 +01:00
Stein Gunnar Bakkeby 3b87b07404
Adding reflow patch (#120) 2024-03-13 10:33:51 +01:00
veltza 9a41526bfb
Fix buffer overflow in xdrawglyph() (#119)
The buffer overflow occurs when the ligatures patch is enabled and
xmakeglyphfontspecs() returns more than one XftGlyphFontSpec.

Ref. https://github.com/cog1to/st-ligatures/issues/35
2024-03-11 22:54:16 +01:00
Bakkeby 7976e611e3 ligatures - moving hbcreatebuffer out of xresources condition ref. #118 2024-03-10 23:41:12 +01:00
Bakkeby 1da419eb35 ligatures + wide glyphs + vertcenter: compatibility fixes ref. #118 2024-03-10 22:18:05 +01:00
Bakkeby f87d3de2cf wide glyphs: fixing compilation error following code refactoring 2024-03-10 10:05:54 +01:00
Bakkeby 9ddc13c0e0 drawcol = dc.col[g.bg]; 2024-03-07 23:40:50 +01:00
Bakkeby e88f2bf20c Removing the VIM browse patch.
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
2024-03-07 22:35:11 +01:00
Bakkeby 340caa5d0a xmakeglyphfontspecs: fix for when not using ligatures 2024-03-07 21:59:15 +01:00
Bakkeby c089485aa4 hidecursor: add config option to disable hidecursor functionality 2024-03-07 21:43:18 +01:00
Bakkeby f79ac733f3 sixel + anysize patch compatibility fix ref. #117 2024-03-07 21:24:31 +01:00
Bakkeby 0f50ef072c ligatures: upgrading 2024-03-07 15:34:21 +01:00
Stein Gunnar Bakkeby 677c2da0be
Reworking sixel implementation based on veltza's implementation (#117)
* 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>
2024-03-07 09:22:44 +01:00
Jordan Callicoat 2e0e84d56a
Add selectioncolors patch (#110)
https://st.suckless.org/patches/selectioncolors/

Closes #91
2024-02-28 14:34:06 +01:00
Bakkeby 3fcf0e3db7 [st][patch][ligatures] Fix ATTR_WRAP attribute handling in layout logic.
Ref. https://git.suckless.org/sites/commit/20d453defdb6ae7bb37f644a2e2831cf2097cdbb.html
2023-11-23 22:21:31 +01:00
Bakkeby 859906235e Fix bounds checks of dc.col
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
2023-10-08 20:18:30 +02:00
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