Commit Graph

292 Commits

Author SHA1 Message Date
Bakkeby 41e6f9dce6 sixel: remove images on escape code 'l' - Reset Mode (RM) ref. #102 2023-09-12 00:16:10 +02:00
Sajay f097dbd079
Check for already exisiting desktop entry (#100)
When st desktop entry already exists it throws error when running make
2023-07-05 11:15:27 +02:00
Bakkeby b82057eb85 Fix for wide character being incorrectly cleared on MODE_INSERT
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
2023-06-25 14:19:27 +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 1343b29ee5 Bump to 211964d.
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
2023-04-07 14:31:41 +02:00
Bakkeby 18e7dc5545 Bump to f17abd2.
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
2023-04-07 14:28:19 +02:00
Bakkeby da9835bdf0 Bump to 7e8050c.
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
2023-04-07 14:25:12 +02:00
Bakkeby a8e2af0d92 ligatures: adding 0 initialiser for features array ref. #93 2023-01-09 10:08:19 +01: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 4dfb6683cd Adding the COLORTERM environment variable 2022-10-24 11:26:36 +02:00
badarg1 6ce9ec69ad
Fixed a glitch when using using the keyboardselect and scrollback patches. (#48)
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>
2022-10-17 13:39:34 +02:00
step d58abd5638
dedup XK_Z in fixkeyboardinput.c (#87)
Closes #85.
2022-10-15 15:40:39 +02:00
Bakkeby 13f2b133eb Bump to 68d1ad9.
FAQ: document the color emojis crash issue which affected some systems is fixed

It is fixed in libXft 2.3.6:

https://gitlab.freedesktop.org/xorg/lib/libxft/-/blob/libXft-2.3.5/NEWS

bump version to 1.5

Ref.
https://git.suckless.org/st/commit/00085199039ee63acc7b1ecb7e3774a9c3552b2a.html
https://git.suckless.org/st/commit/68d1ad9b54e952e3079356aeab8ab37e44c56c2c.html
2022-10-06 15:33:26 +02:00
Bakkeby 35b7da0919 alpha focus highlight: upgrade patch to latest (20200731-43a395a) 2022-10-06 13:20:27 +02:00
Bakkeby f899d0552a alpha: remove debug print statements from changealpha 2022-10-01 08:37:17 +02:00
Utkarsh Verma 2d74e49c4f Add function for changing alpha (#47)
Co-authored-by: Stein Gunnar Bakkeby <bakkeby@gmail.com>
2022-09-24 11:04:38 +02:00
step 499b7fbc19
XRESOURCES_RELOAD_PATCH reload fonts + re-render (#84)
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.
2022-09-24 10:40:33 +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 89ced627cd font2: adding use XftFontMatch patch compatibility
Also adding support for using size in addition to
pixelsize when configuring fonts.

Ref. https://github.com/bakkeby/dwm-flexipatch/issues/294
2022-08-29 09:50:47 +02:00
Bakkeby 2906447fef Adding use XftFontMatch patch 2022-08-28 21:05:55 +02:00
Bakkeby cc36f7c256 Adding URL for no decorations patch 2022-08-24 11:29:55 +02:00
Bakkeby 3947ceb431 Adding the no window decorations patch 2022-08-24 11:04:49 +02:00
Bakkeby cd1aa57a06 Bump to 72fd327.
st: use `void' to indicate an empty parameter list

Ref.
https://git.suckless.org/st/commit/72fd32736a612edec43596c14148322122a5544d.html
2022-08-18 17:30:18 +02:00
step 427895a7c2
Fix externalpipein patch (#78)
* 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.
2022-08-16 16:49:10 +02:00
Bakkeby bcfa5b9b7f wide glyphs: adding alternative patch ref. #56 2022-08-11 15:56:42 +02:00
Bakkeby bdeb1e7c4c openurlonclick: using posix_spawnp instead of system ref. comments in #76 2022-08-11 15:04:44 +02:00
Bakkeby 2eca262969 openurlonclick: fix for edge case that can cause a crash 2022-08-11 09:13:29 +02:00
Stein Gunnar Bakkeby b12cd70e8b
Merge pull request #76 from veltza/add-scrollback-support-to-openurlonclick
Add scrollback support to the openurlonclick patch
2022-08-10 21:30:57 +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 9e0e419781 xresources reload: should close the display after being finished with the connection (if not then it can cause "Maximum amount of clients reached" errors after some time) 2022-07-28 15:48:40 +02: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
Stein Gunnar Bakkeby 4d4a5ed565
Merge pull request #75 from veltza/fix-anysize-borders
Fix border issues in the anysize patch
2022-07-18 11:46:42 +02:00
veltza f4b32e05a1 Fix border issues in the anysize patch 2022-07-16 23:35:27 +03:00
Bakkeby dc8abceeca Makefile: add manual path for OpenBSD
ref. https://git.suckless.org/st/commit/baa9357e96d2478baa52a3301e70ac80a229b726.html
2022-07-10 17:11:39 +02:00
Stein Gunnar Bakkeby 4ccd248a50
Merge pull request #74 from veltza/fix-incomplete-merge
Fix the incomplete merge from upstream (78adbd2)
2022-07-10 17:07:29 +02:00
veltza 64aa505248 Fix the incomplete merge from upstream (78adbd2)
Ref. https://git.suckless.org/st/commit/1d3142da968da7f6f61f1c1708f39ca233eda150.html
2022-07-09 11:55:26 +03:00
Bakkeby ac9f541965 [st][patch][ligatures] fix potential buffer overflow in shaping code ref. https://git.suckless.org/sites/commit/05a0d9b6bf500a7b2955c4299a1912eb302ce40b.html 2022-07-05 15:32:06 +02:00
Stein Gunnar Bakkeby ff557169e4
Merge pull request #73 from veltza/change-ctrl-l-behavior
Change Ctrl+l behaviour to preserve the scrollback buffer when clearing the screen
2022-07-02 17:59:51 +02:00
veltza a705b714b5 Change Ctrl+l behaviour
From now on, Ctrl+l scrolls up the screen and preserves the scrollback buffer.
Fixes #46.
2022-07-02 12:48:30 +03:00
Stein Gunnar Bakkeby df36caf56b
Merge pull request #68 from veltza/fix-flickering-sixels
Fix flickering when sixel images are moving
2022-06-10 13:46:42 +02:00
veltza 2e6ffa28f4 Fix flickering when sixel images are moving 2022-06-08 00:51:58 +03:00
Stein Gunnar Bakkeby 6e962cc929
Merge pull request #66 from myNameIsPK/master
Fix typo
2022-06-04 20:00:15 +02:00
myNameIsPK bca5e344fa
Fix typo 2022-06-04 04:51:57 +07:00
bakkeby 3e41e252b1 Adding background image reload patch ref. pull request #62 2022-04-11 16:04:58 +02:00
bakkeby d8ec7a396c base64_digits: reduce scope, implicit zero, +1 size
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
2022-03-28 11:23:52 +02:00
bakkeby addd5e9749 avoid potential UB when using isprint()
all the ctype.h functions' argument must be representable as an unsigned
char or as EOF, otherwise the behavior is undefined.

ref. https://git.suckless.org/st/commit/af3bb68add1c40d19d0dee382009e21b0870a38f.html
2022-03-28 11:21:42 +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 289485bd50 background image: use xmalloc instead of malloc to exit st on malloc failures 2022-03-11 10:17:31 +01:00