Commit Graph

256 Commits

Author SHA1 Message Date
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
bakkeby
faac64e392 background image: make sure to close the farbfeld file on error 2022-03-11 09:40:18 +01:00
bakkeby
1a8175a337 Adding background image patch 2022-03-10 13:54:28 +01:00
bakkeby
51dc6ba469 scrollback: do not scroll up when already at the top ref. #57 2022-03-06 14:18:49 +01:00
bakkeby
4a156b95f9 Delay redrawals on palette changes
Build on auto-sync and only mark window dirty on palette changes and let
the event handler do the actual draw.

Ref.
   - https://git.suckless.org/st/commit/e823e2308f2a99023032a3966ebb7036a31d305f.html
2022-02-24 13:46:37 +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
9a86625780 LICENSE: bump year
Ref.
   - https://git.suckless.org/st/commit/b1d97fec47b0d6633addb848131388ec40154ebc.html
2022-02-24 13:38:54 +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
b2dffe8a25 bump version to 0.8.5
Ref.
   - https://git.suckless.org/st/commit/7fb0c0cc681f36be2ad12091ef93a41671f32738.html
2022-02-24 13:29:14 +01:00
bakkeby
643ab6720e FAQ: fix a typo, patch -> path
Ref.
   - https://git.suckless.org/st/commit/7e1c68f25d9f08687a94eeef8d7f8ffd0d14b911.html
2022-02-24 13:28:10 +01:00
bakkeby
b5d7194d90 Fix overtyping wide characters.
Overtyping the first half of a wide character with the
second half of a wide character results in display garbage.
This is because the trailing dummy is not cleaned up.

i.e.  ATTR_WIDE, ATTR_WDUMMY, ATTR_WDUMMY

Here is a short script for demonstrating the behavior:

	#!/bin/sh
	alias printf=/usr/bin/printf
	printf こんにちは!; sleep 2
	printf '\x1b[5D'; sleep 2
	printf へ; sleep 2
	printf ' '; sleep 2
	echo

Ref.
   - https://git.suckless.org/st/commit/65f1dc428315ae9d7f362e10c668557c1379e7af.html
2022-02-24 13:27:04 +01:00
bakkeby
1a7cc16bec Fix null pointer access in strhandle
According to the spec the argument is optional for 104, so p can be
NULL as can be tested with printf '\x1b]104\x07'. This is a regression
of 8e31030.

Ref.
   - https://git.suckless.org/st/commit/a0467c802d4f86ed162486e3453dd61181423902.html
2022-02-24 13:25:36 +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
Stein Gunnar Bakkeby
ea91b10dab
Merge pull request #42 from stevenrace/patch-1
Update patches.def.h to address spelling error
2021-10-14 12:03:52 +02:00
Steven
ac7b02b841
Update patches.def.h
Spelling fix.
2021-10-14 04:57:44 -05:00
Stein Gunnar Bakkeby
f78822a367
Merge pull request #41 from dosisod/fix-sixel-alpha
Fix white background bleeding through sixel images:
2021-09-13 11:09:20 +02:00
dosisod
a11209e6ed Fix white background bleeding through sixel images:
Tested with and without alpha patch applied. Simply setting alpha to 255
seems to fix it. I didn't set `dst` on lines 263 and 273 because those
loops are impossible to reach.
2021-09-12 11:18:06 -07: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
78adbd2406 fix a problem that the standard streams are unexpectedly closed
In the current implementation, the slave PTY (assigned to the variable
`s') is always closed after duplicating it to file descriptors of
standard streams (0, 1, and 2). However, when the allocated slave PTY
`s' is already one of 0, 1, or 2, this causes unexpected closing of a
standard stream. The same problem occurs when the file descriptor of
the master PTY (the variable `m') is one of 0, 1, or 2.

In this patch, the original master PTY (m) is closed before it would
be overwritten by duplicated slave PTYs. The original slave PTY (s)
is closed only when it is not one of the standarad streams.

Ref. https://git.suckless.org/st/commit/1d3142da968da7f6f61f1c1708f39ca233eda150.html
2021-08-24 14:57:35 +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
390735695e [st][patch][csi_22_23] Styling fix; update terminfo
Ref. https://git.suckless.org/sites/commit/24b1680884ca471123b3ad3a7442bfa5f402d6aa.html
2021-08-18 10:29:12 +02:00
bakkeby
0045b68966 open copied url: add exec promise to pledge for OpenBSD
Ref. https://git.suckless.org/sites/commit/a30f1e4947c67cfdde4aa094d45b54c571ef74c5.html
2021-08-18 10:11:34 +02:00
bakkeby
271a807111 Adding the CSI 22, 23 patch 2021-08-18 10:07:42 +02:00
bakkeby
b84e8366ab Updating SIXEL comment about uncommenting in config.mk instead of Makefile ref. #35 2021-08-05 10:17:38 +02:00
Stein Gunnar Bakkeby
1fab5f6e4f
Merge pull request #39 from Hejsil/fix-buffer-overflows-in-openurl-patch
Fix buffer overflows in openurlonclick.c
2021-08-03 17:51:57 +02:00
Komari Spaghetti
45476fccb3 Fix buffer overflows in openurlonclick.c 2021-08-03 16:22:00 +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
5452c4f4d3 Removing 't' case for SIXEL patch ref. #35.
#if SIXEL_PATCH
	case 't':
		/* TODO should probably not be hard-coded */
		ttywrite(";420;720t", 10, 1);
		break;
	#endif // SIXEL_PATCH

This would result in printing ";420;720t" when exiting neovim.

Without this code a line is written to standard err instead:

erresc: unknown csi ESC[23;0t

The ttywrite was added as part of this commit:
   - b50be8225d

which states:

> When a S or T CSI escape was encountered, the lines which were scrolled
> away would be deleted from the scrollback buffer. This has been
> corrected - the lines are now preseved.
>
> This fixes a bug where issuing `clear` followed by `lsix` would cause
> the line on which the `lsix` was issued to disappear from the scrollback
> buffer.
>
> Note that the line may scroll out of view and thus dissapear, but it
> will now be preserved in the scrollback buffer.

Given that we could not reproduce the above bug without the ttywrite in
this case I am not convinced that this is actually needed. Leaving this
here in case this comes up again in the future.
2021-07-29 17:15:09 +02:00
bakkeby
f643835542 Adding simple version of the anysize patch ref. #35 2021-07-29 12:22:44 +02:00
bakkeby
eccd7fac9e Adding columns patch ref. #34 2021-07-26 10:16:54 +02:00
bakkeby
d1b9cca73c Adding clearing of images and scrollback history when using clear ref. #30 2021-07-19 10:15:01 +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
b39782fdcf Removing gross purging of sixels code ref. #30 2021-07-18 18:12:47 +02:00
bakkeby
04a194c013 newterm: dwm swallow compatibility
There is a compatibility issue between the dwm swallow patch and the
newterm patch for st.

The swallow patch identifies the terminal client to substitute by
traversing the process tree checking if the new window is a descendant
of a terminal client.

The newterm patch for st spawns a new terminal that is a descendant of
the parent st process.

This can lead to situations where the swallow patch ends up replacing
the wrong terminal window.

Changed the forking mechanism to do a double fork and letting the
first one die. This is a technique commonly used by daemons to spawn
new orphan processes.
2021-07-12 09:25:52 +02:00
bakkeby
ee4cdc8d6e Adding openurlonclick patch ref. #32 2021-07-07 10:08:43 +02:00
bakkeby
b5c196f009 Reverting OSC 10 and 11 changes ref. #30 2021-07-07 09:49:57 +02:00