Adding default cursor patch

This commit is contained in:
bakkeby 2021-05-11 16:35:30 +02:00
parent 2d59f21271
commit 5adf4c4c8e
3 changed files with 29 additions and 0 deletions

View File

@ -15,6 +15,8 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
### Changelog: ### Changelog:
2021-05-11 - Added default cursor patch
2021-05-10 - Upgrade to 46b02f, 2021-03-28 2021-05-10 - Upgrade to 46b02f, 2021-03-28
2021-05-09 - Added the sync, alpha-focus-hightlight and vim browse patches 2021-05-09 - Added the sync, alpha-focus-hightlight and vim browse patches
@ -98,6 +100,10 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
- this patch allows you to select and copy the last URL displayed with Mod+l - this patch allows you to select and copy the last URL displayed with Mod+l
- multiple invocations cycle through the available URLs - multiple invocations cycle through the available URLs
- default-cursor
- minor change allowing escape sequences like `\e[ q` or `\e[0 q` to set the cursor back to default configuration instead of a blinking block
- while many terminals do this the behaviour is not according to the specification
- [delkey](https://st.suckless.org/patches/delkey/) - [delkey](https://st.suckless.org/patches/delkey/)
- return BS on pressing backspace and DEL on pressing the delete key - return BS on pressing backspace and DEL on pressing the delete key

View File

@ -80,6 +80,21 @@
*/ */
#define COPYURL_HIGHLIGHT_SELECTED_URLS_PATCH 0 #define COPYURL_HIGHLIGHT_SELECTED_URLS_PATCH 0
/* According to the specification (see link in BLINKING_CURSOR_PATCH) the "Set cursor style
* (DECSCUSR), VT520." escape sequences define both values of 0 and 1 as a blinking block,
* with 1 being the default.
*
* 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.
*/
#define DEFAULT_CURSOR_PATCH 0
/* Return BS on pressing backspace and DEL on pressing the delete key. /* Return BS on pressing backspace and DEL on pressing the delete key.
* https://st.suckless.org/patches/delkey/ * https://st.suckless.org/patches/delkey/
*/ */

8
x.c
View File

@ -2405,7 +2405,15 @@ xsetcursor(int cursor)
if (!BETWEEN(cursor, 0, 7)) /* 7: st extension */ if (!BETWEEN(cursor, 0, 7)) /* 7: st extension */
#endif // BLINKING_CURSOR_PATCH #endif // BLINKING_CURSOR_PATCH
return 1; return 1;
#if DEFAULT_CURSOR_PATCH
#if BLINKING_CURSOR_PATCH
win.cursor = (cursor ? cursor : cursorstyle);
#else
win.cursor = (cursor ? cursor : cursorshape);
#endif // BLINKING_CURSOR_PATCH
#else
win.cursor = cursor; win.cursor = cursor;
#endif // DEFAULT_CURSOR_PATCH
#if BLINKING_CURSOR_PATCH #if BLINKING_CURSOR_PATCH
cursorblinks = win.cursor == 0 || win.cursor == 1 || cursorblinks = win.cursor == 0 || win.cursor == 1 ||
win.cursor == 3 || win.cursor == 5 || win.cursor == 3 || win.cursor == 5 ||