Skip to content

Commit

Permalink
Adding default cursor patch
Browse files Browse the repository at this point in the history
  • Loading branch information
bakkeby committed May 11, 2021
1 parent 2d59f21 commit 5adf4c4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Refer to [https://st.suckless.org/](https://st.suckless.org/) for details on the
### Changelog:
2021-05-11 - Added default cursor patch
2021-05-10 - Upgrade to 46b02f, 2021-03-28
2021-05-09 - Added the sync, alpha-focus-hightlight and vim browse patches
Expand Down Expand Up @@ -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
- 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/)
- return BS on pressing backspace and DEL on pressing the delete key
Expand Down
15 changes: 15 additions & 0 deletions patches.def.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,21 @@
*/
#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.
* https://st.suckless.org/patches/delkey/
*/
Expand Down
8 changes: 8 additions & 0 deletions x.c
Original file line number Diff line number Diff line change
Expand Up @@ -2405,7 +2405,15 @@ xsetcursor(int cursor)
if (!BETWEEN(cursor, 0, 7)) /* 7: st extension */
#endif // BLINKING_CURSOR_PATCH
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;
#endif // DEFAULT_CURSOR_PATCH
#if BLINKING_CURSOR_PATCH
cursorblinks = win.cursor == 0 || win.cursor == 1 ||
win.cursor == 3 || win.cursor == 5 ||
Expand Down

0 comments on commit 5adf4c4

Please sign in to comment.