Re: [wiki] [sites] Add updated patch || Steve Ward

From: jvyden <jvyden_AT_volatile.bz>
Date: Sat, 16 May 2020 10:14:22 -0400

I believe you may have submitted the wrong patch, as I don't see my changes in this patch, or any change that would inhibit the blinking behavior.
Also, feel free to include my email, jvyden_AT_volatile.bz, in the authors section.

Thanks for submitting my patch regardless.

On Sat, 16 May 2020 05:04:13 +0200
git_AT_suckless.org wrote:

> commit 80c5f5f90bc3ab530fc847de1b0082ff1baaa1aa
> Author: Steve Ward <planet36_AT_gmail.com>
> Date: Fri May 15 23:03:52 2020 -0400
>
> Add updated patch
>
> diff --git a/st.suckless.org/patches/blinking_cursor/index.md b/st.suckless.org/patches/blinking_cursor/index.md
> index ad042a5c..d828e034 100644
> --- a/st.suckless.org/patches/blinking_cursor/index.md
> +++ b/st.suckless.org/patches/blinking_cursor/index.md
> _AT_@ -14,6 +14,8 @@ To demonstrate the available cursor styles, try these commands:
> echo -e -n "\x1b[\x35 q" # blinking bar
> echo -e -n "\x1b[\x36 q" # steady bar
>
> +When drawing is triggered, the cursor does not blink.
> +
> Notes
> -----
> * Only cursor styles 0, 1, 3, and 5 blink. Set `cursorstyle` accordingly.
> _AT_@ -22,8 +24,10 @@ Notes
> Download
> --------
> * [st-blinking\_cursor-20200511-914fb82.diff](st-blinking_cursor-20200511-914fb82.diff)
> +* [st-blinking\_cursor-20200515-045a0fa.diff](st-blinking_cursor-20200515-045a0fa.diff)
>
> Authors
> -------
> * Genki Sky - <https://lists.suckless.org/hackers/1708/15376.html>
> -* Steve Ward - <planet36_AT_gmail.com> (914fb82 change)
> +* Steve Ward - <planet36_AT_gmail.com>
> +* jvyden
> diff --git a/st.suckless.org/patches/blinking_cursor/st-blinking_cursor-20200515-045a0fa.diff b/st.suckless.org/patches/blinking_cursor/st-blinking_cursor-20200515-045a0fa.diff
> new file mode 100644
> index 00000000..bb57950e
> --- /dev/null
> +++ b/st.suckless.org/patches/blinking_cursor/st-blinking_cursor-20200515-045a0fa.diff
> _AT_@ -0,0 +1,123 @@
> +From 7b2ee699f5e5759ac034765d82cbe9ebab65f30a Mon Sep 17 00:00:00 2001
> +From: Steve Ward <planet36_AT_gmail.com>
> +Date: Fri, 15 May 2020 22:50:00 -0400
> +Subject: [PATCH] Enable blinking cursor
> +
> +Adapted from this patch
> +https://lists.suckless.org/hackers/1708/15376.html
> +
> +Idea to inhibit blinking cursor during drawing inspired by this patch
> +https://lists.suckless.org/hackers/2005/17339.html
> +
> +Rename cursorshape to cursorstyle
> +---
> + config.def.h | 15 ++++++++++-----
> + x.c | 23 ++++++++++++++++++++---
> + 2 files changed, 30 insertions(+), 8 deletions(-)
> +
> +diff --git a/config.def.h b/config.def.h
> +index fdbacfd..f404201 100644
> +--- a/config.def.h
> ++++ b/config.def.h
> +_AT_@ -129,13 +129,18 @@ static unsigned int defaultcs = 256;
> + static unsigned int defaultrcs = 257;
> +
> + /*
> +- * Default shape of cursor
> +- * 2: Block ("█")
> +- * 4: Underline ("_")
> +- * 6: Bar ("|")
> ++ * 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
> ++ * Default style of cursor
> ++ * 0: blinking block
> ++ * 1: blinking block (default)
> ++ * 2: steady block ("█")
> ++ * 3: blinking underline
> ++ * 4: steady underline ("_")
> ++ * 5: blinking bar
> ++ * 6: steady bar ("|")
> + * 7: Snowman ("☃")
> + */
> +-static unsigned int cursorshape = 2;
> ++static unsigned int cursorstyle = 1;
> +
> + /*
> + * Default columns and rows numbers
> +diff --git a/x.c b/x.c
> +index 1dc44d6..bf280fe 100644
> +--- a/x.c
> ++++ b/x.c
> +_AT_@ -1528,13 +1528,20 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
> + switch (win.cursor) {
> + case 7: /* st extension: snowman (U+2603) */
> + g.u = 0x2603;
> +- /* FALLTHROUGH */
> ++ xdrawglyph(g, cx, cy);
> ++ break;
> + case 0: /* Blinking Block */
> + case 1: /* Blinking Block (Default) */
> ++ if (IS_SET(MODE_BLINK))
> ++ break;
> ++ /* FALLTHROUGH */
> + case 2: /* Steady Block */
> + xdrawglyph(g, cx, cy);
> + break;
> + case 3: /* Blinking Underline */
> ++ if (IS_SET(MODE_BLINK))
> ++ break;
> ++ /* FALLTHROUGH */
> + case 4: /* Steady Underline */
> + XftDrawRect(xw.draw, &drawcol,
> + borderpx + cx * win.cw,
> +_AT_@ -1543,6 +1550,9 @@ xdrawcursor(int cx, int cy, Glyph g, int ox, int oy, Glyph og)
> + win.cw, cursorthickness);
> + break;
> + case 5: /* Blinking bar */
> ++ if (IS_SET(MODE_BLINK))
> ++ break;
> ++ /* FALLTHROUGH */
> + case 6: /* Steady bar */
> + XftDrawRect(xw.draw, &drawcol,
> + borderpx + cx * win.cw,
> +_AT_@ -1871,6 +1881,7 @@ run(void)
> + int xfd = XConnectionNumber(xw.dpy), ttyfd, xev, drawing;
> + struct timespec seltv, *tv, now, lastblink, trigger;
> + double timeout;
> ++ int blinkcursor;
> +
> + /* Waiting for window mapping */
> + do {
> +_AT_@ -1937,6 +1948,10 @@ run(void)
> + if (FD_ISSET(ttyfd, &rfd) || xev) {
> + if (!drawing) {
> + trigger = now;
> ++ if (IS_SET(MODE_BLINK)) {
> ++ win.mode ^= MODE_BLINK;
> ++ }
> ++ lastblink = now;
> + drawing = 1;
> + }
> + timeout = (maxlatency - TIMEDIFF(now, trigger)) \
> +_AT_@ -1947,7 +1962,9 @@ run(void)
> +
> + /* idle detected or maxlatency exhausted -> draw */
> + timeout = -1;
> +- if (blinktimeout && tattrset(ATTR_BLINK)) {
> ++ blinkcursor = win.cursor == 0 || win.cursor == 1 ||
> ++ win.cursor == 3 || win.cursor == 5;
> ++ if (blinktimeout && (blinkcursor || tattrset(ATTR_BLINK))) {
> + timeout = blinktimeout - TIMEDIFF(now, lastblink);
> + if (timeout <= 0) {
> + if (-timeout > blinktimeout) /* start visible */
> +_AT_@ -1983,7 +2000,7 @@ main(int argc, char *argv[])
> + {
> + xw.l = xw.t = 0;
> + xw.isfixed = False;
> +- win.cursor = cursorshape;
> ++ win.cursor = cursorstyle;
> +
> + ARGBEGIN {
> + case 'a':
> +--
> +2.20.1
> +
>
>
Received on Sat May 16 2020 - 16:14:22 CEST

This archive was generated by hypermail 2.3.0 : Sat May 16 2020 - 16:24:46 CEST