This would allow applications like neovim using this VT520 feature to
produce a faster blinking underline and bar cursor and a slower blinking
block cursor.
-- Maybe also support cursor blinking delays where on != off. A second
- parameter could be added to the speed configuration sequence. This would
- be useful to have a mostly on cursor that occasionally briefly blinks just
- to get noticeable.
- On RPI when omxplayer is launched directly from analogterm2 and bash, it
does not behave exactly like under xterm or urxvt: keys sent to omxplayer
may either still be sent to analogterm2 or the terminal may be in another
int cfg_color, cfg_monocolor;
bool cfg_mono;
-int cfg_refreshspeed, cfg_blinkspeed, cfg_cursormode, cfg_flashtime;
+int cfg_refreshspeed, cfg_blinkspeedon, cfg_blinkspeedoff, cfg_cursormode,
+ cfg_flashtime;
bool cfg_cursorblink, cfg_cursordisable, cfg_cursorbright,
cfg_cursorprintreset;
int cfg_intmin, cfg_intstep, cfg_intfg, cfg_intscan, cfg_intbg;
cfg_monocolor = DEFAULT_MONOCOLOR;
cfg_mono = MONOCHROME;
cfg_refreshspeed = REFRESH_SPEED;
- cfg_blinkspeed = BLINK_SPEED;
+ cfg_blinkspeedon = BLINK_SPEED_ON;
+ cfg_blinkspeedoff = BLINK_SPEED_OFF;
cfg_cursormode = CURSOR_MODE;
cfg_flashtime = FLASH_TIME;
cfg_cursorblink = CURSOR_BLINK;
/*
* The interval timer used to toggle text and cursor blinking, in number of
- * REFRESH_SPEED ticks.
+ * REFRESH_SPEED ticks. ON and OFF are designed to be able to optionally be
+ * asymmetric.
*/
-#define BLINK_SPEED 15
+#define BLINK_SPEED_ON 40
+#define BLINK_SPEED_OFF 10
-extern int cfg_blinkspeed;
+extern int cfg_blinkspeedon, cfg_blinkspeedoff;
/*
*
static void
alarm_sighandler(int sig)
{
+ int blinkspeed;
if (sig != SIGALRM)
return;
refresh_expired = true;
- if (++blink_ticks == cfg_blinkspeed) {
+ blinkspeed = (draw_blink_state ? cfg_blinkspeedoff : cfg_blinkspeedon);
+ if (++blink_ticks == blinkspeed) {
blink_ticks = 0;
draw_blink_state = !draw_blink_state;
state->blink_update = true;
draw_blink_reset(void)
{
+ draw_blink_state = true;
blink_ticks = 0;
+ state->blink_update = true;
}
void
errno = EINVAL;
fprintf(stderr,
"\nUsage: %s [-8|-u] [-w <cols>] [-h <rows>] [-E <n>] [-s]\n"
- " [-C <color>] [-c] [-W] [-b] [-r <ms>] [-B <ticks>] [-j <n>]\n"
- " [-P] [-m <mode>] [-M] [-d] [-D] [-S] [-p <parameters>]\n"
- " [-l <pixels>] [-f <delay>] [-U] [-z <ms>] [-Z <skip>]\n"
- " [-e <command> [<arguments>]]\n\n"
+ " [-C <col>] [-c] [-W] [-b] [-r <ms>] [-B <ticks>[,<ticks>]]\n"
+ " [-j <n>] [-P] [-m <mode>] [-M] [-d] [-D] [-S]\n"
+ " [-p <parameters>] [-l <pixels>] [-f <delay>] [-U] [-z <ms>]\n"
+ " [-Z <skip>] [-e <command> [<arguments>]]\n\n"
"Where:\n"
" -8 / -u - 8-bit mode (Latin-1), unicode+UTF-8. 8-bit mode is\n"
" automatically enabled by default if the LANG\n"
" DEC Private Mode sequence 4: [?4h and [?4l.\n"
" -b - Toggle blinking cursor.\n"
" -B - Set the cursor and text blinking speed, in refresh ticks.\n"
- " This can also be changed with ESC [?658467;65538;<n>h\n"
+ " Two comma-separated values may optionally be provided for\n"
+ " asymmetric on/off delays. One value sets both symmetric.\n"
+ " Can also be changed with ESC [?658467;65538;<n>[;<n>]h\n"
" This depends on the refresh rate setting, -r.\n"
" -j - Maximum number of lines to jump in fast scrolling mode.\n"
" Also depends on the -r setting.\n"
cfg_cursorblink = !cfg_cursorblink;
break;
case 'B':
- if ((i = atoi(optarg)) > 0 && i < 501)
- cfg_blinkspeed = i;
+ {
+ char *cols[2], *str;
+ int son = cfg_blinkspeedon,
+ soff = cfg_blinkspeedoff;
+
+ if ((str = strdup(optarg)) == NULL)
+ err(EXIT_FAILURE, "stddup()");
+ if (cfg_strspl(cols, str, 2, ',') == 2) {
+ son = atoi(cols[0]);
+ soff = atoi(cols[1]);
+ } else
+ son = soff = atoi(optarg);
+ free(str);
+ if (son > 0 && son < 501)
+ cfg_blinkspeedon = son;
+ if (soff > 0 && soff < 501)
+ cfg_blinkspeedoff = soff;
+ }
break;
case 'j':
if ((i = atoi(optarg)) > 1 && i <= 16)
st->cursor_bright
= false;
}
- } else if (state->curparam == 2 &&
+ } else if ((state->curparam == 2 ||
+ state->curparam == 3) &&
state->csiparam[1] ==
65538) {
- int s = state->csiparam[2];
+ int s1 = state->csiparam[2],
+ s2 = (state->curparam == 3
+ ? state->csiparam[3]
+ : s1);
/* Blinking speed */
- if (s > 0 && s < 501) {
- cfg_blinkspeed = s;
- draw_blink_reset();
- }
+ if (s1 > 0 && s1 < 501)
+ cfg_blinkspeedon = s1;
+ if (s2 > 0 && s2 < 501)
+ cfg_blinkspeedoff = s2;
+ draw_blink_reset();
} else if (state->curparam == 3 &&
state->csiparam[1] ==
65539) {