st default_cursor patch, bumping version

pull/74/head
bakkeby 12 months ago
parent b01e4791a4
commit f79d7d3b9c

@ -1,48 +0,0 @@
From 89d9a5046a6af6b80fd4804a71f8dc7496020a6e Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Wed, 12 May 2021 09:13:47 +0200
Subject: [PATCH] Make st interpret cursor 0 as the default cursor.
According to the specification the "Set cursor style
(DECSCUSR), VT520." escape sequences define both values of 0 and 1 as a blinking block,
with 1 being the default.
Refer to:
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h4-Functions-using-CSI-_-ordered-by-the-final-character-lparen-s-rparen:CSI-Ps-SP-q.1D81
This patch allows the default cursor to be set when value 0 is used, as opposed to
setting the cursor to a blinking block.
This allows a command like this to restore the cursor to what st is configured with:
$ echo -ne "\e[ q"
While many terminal emulators do this it is not adhering to specification. xterm is an
example terminal that sets a blinking block instead of the configured one, same as st.
Example use case is changing cursor shape in vim depending on what mode is used:
https://vim.fandom.com/wiki/Change_cursor_shape_in_different_modes
https://askubuntu.com/questions/42663/how-to-make-cursor-change-from-thin-line-to-block-based-on-normal-or-insert-mode
The alternative in this case would be to explicitly set the cursor back to what you expect
it to be (underline, bar) in the vim configuration.
---
x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/x.c b/x.c
index 7186040..0e4b4ee 100644
--- a/x.c
+++ b/x.c
@@ -1708,7 +1708,7 @@ xsetcursor(int cursor)
{
if (!BETWEEN(cursor, 0, 7)) /* 7: st extension */
return 1;
- win.cursor = cursor;
+ win.cursor = (cursor ? cursor : cursorshape);
return 0;
}
--
2.32.0

@ -1,4 +1,4 @@
From 89d9a5046a6af6b80fd4804a71f8dc7496020a6e Mon Sep 17 00:00:00 2001
From 1080661abe54eb51480a960949309d99f3d3f88d Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Wed, 12 May 2021 09:13:47 +0200
Subject: [PATCH] Make st interpret cursor 0 as the default cursor.
@ -31,10 +31,10 @@ it to be (underline, bar) in the vim configuration.
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/x.c b/x.c
index 7186040..0e4b4ee 100644
index aa09997..f569bb1 100644
--- a/x.c
+++ b/x.c
@@ -1708,7 +1708,7 @@ xsetcursor(int cursor)
@@ -1739,7 +1739,7 @@ xsetcursor(int cursor)
{
if (!BETWEEN(cursor, 0, 7)) /* 7: st extension */
return 1;
@ -44,5 +44,5 @@ index 7186040..0e4b4ee 100644
}
--
2.34.1
2.41.0
Loading…
Cancel
Save