Commit Graph

186 Commits

Author SHA1 Message Date
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
bakkeby
426eca8f2e Adding proposed scrollback changes for sixel graphics ref. #30 2021-07-07 09:43:43 +02:00
Stein Gunnar Bakkeby
fb8d6e378c
Merge pull request #31 from Ultrahalf/master
Fix typo
2021-06-27 09:38:51 +02:00
Muhamad Althaf
034569c2b2
Fix typo 2021-06-27 12:28:14 +05:30
bakkeby
b0660ecf47 Adding hide terminal cursor patch 2021-06-09 09:54:50 +02:00
bakkeby
ba7f4f98e2 ligatures: addressing boxdraw compatibility issue ref. #29 2021-05-24 13:36:14 +02:00
bakkeby
ad7e16b38a Adding swapmouse patch ref. #28 2021-05-16 11:40:15 +02:00
bakkeby
80bb4b8ab7 externalpipe: sigchld changes interfere with right-click-to-plumb and opencopied patches, proposed fix ref. #27 2021-05-15 11:44:09 +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
78e025a0e7 Upgrading to latest master, 46b02f, 2021-03-28 2021-05-10 10:43:48 +02:00
bakkeby
72ee5f3307 vim-browse: fix for missing history overlay 2021-05-10 10:43:38 +02:00
bakkeby
63d9b8eefe execsh: missing arg argument
https://git.suckless.org/st/commit/21e0d6e8b8d20903494386e7e6f43201b3761154.html
2021-05-10 10:33:25 +02:00
bakkeby
896f5a08c8 Upgrading to latest master, 46b02f, 2021-03-28 2021-05-10 09:39:02 +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