mirror of
https://github.com/mintycube/st.git
synced 2024-10-22 14:05:49 +02:00
undercurl: support semicolons in SGR character attributes ref. #148
Back in May 2024 support for colons in SGR character attributes was added to allow both colons and semicolons to be used to separate the subparameters in SGR escape codes. The undercurl patch only read colons to separate parameters. This commit allows for semicolons to be used as well when using escape codes for undercurl. https://invisible-island.net/xterm/ctlseqs/ctlseqs.html https://git.suckless.org/st/commit/5dbcca49263be094fc38159c297458ae323ef647.html https://st.suckless.org/patches/undercurl/
This commit is contained in:
parent
fe065cc366
commit
398aeb1cd6
19
st.c
19
st.c
@ -170,7 +170,7 @@ static void csihandle(void);
|
|||||||
static void dcshandle(void);
|
static void dcshandle(void);
|
||||||
#endif // SIXEL_PATCH
|
#endif // SIXEL_PATCH
|
||||||
#if UNDERCURL_PATCH
|
#if UNDERCURL_PATCH
|
||||||
static void readcolonargs(char **, int, int[][CAR_PER_ARG]);
|
static void readcolonargs(char **, int, int[][CAR_PER_ARG], int sep);
|
||||||
#endif // UNDERCURL_PATCH
|
#endif // UNDERCURL_PATCH
|
||||||
static void csiparse(void);
|
static void csiparse(void);
|
||||||
static void csireset(void);
|
static void csireset(void);
|
||||||
@ -1483,20 +1483,21 @@ tnewline(int first_col)
|
|||||||
|
|
||||||
#if UNDERCURL_PATCH
|
#if UNDERCURL_PATCH
|
||||||
void
|
void
|
||||||
readcolonargs(char **p, int cursor, int params[][CAR_PER_ARG])
|
readcolonargs(char **p, int cursor, int params[][CAR_PER_ARG], int sep)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for (; i < CAR_PER_ARG; i++)
|
for (; i < CAR_PER_ARG; i++)
|
||||||
params[cursor][i] = -1;
|
params[cursor][i] = -1;
|
||||||
|
|
||||||
if (**p != ':')
|
if (**p != sep)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char *np = NULL;
|
char *np = NULL;
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
while (**p == ':' && i < CAR_PER_ARG) {
|
while (**p == sep && i < CAR_PER_ARG) {
|
||||||
while (**p == ':')
|
while (**p == sep)
|
||||||
(*p)++;
|
(*p)++;
|
||||||
params[cursor][i] = strtol(*p, &np, 10);
|
params[cursor][i] = strtol(*p, &np, 10);
|
||||||
*p = np;
|
*p = np;
|
||||||
@ -1528,11 +1529,13 @@ csiparse(void)
|
|||||||
v = -1;
|
v = -1;
|
||||||
csiescseq.arg[csiescseq.narg++] = v;
|
csiescseq.arg[csiescseq.narg++] = v;
|
||||||
p = np;
|
p = np;
|
||||||
#if UNDERCURL_PATCH
|
|
||||||
readcolonargs(&p, csiescseq.narg-1, csiescseq.carg);
|
|
||||||
#endif // UNDERCURL_PATCH
|
|
||||||
if (sep == ';' && *p == ':')
|
if (sep == ';' && *p == ':')
|
||||||
sep = ':'; /* allow override to colon once */
|
sep = ':'; /* allow override to colon once */
|
||||||
|
#if UNDERCURL_PATCH
|
||||||
|
if (v == 4 || v == 58)
|
||||||
|
readcolonargs(&p, csiescseq.narg-1, csiescseq.carg, sep);
|
||||||
|
#endif // UNDERCURL_PATCH
|
||||||
|
|
||||||
if (*p != sep || csiescseq.narg == ESC_ARG_SIZ)
|
if (*p != sep || csiescseq.narg == ESC_ARG_SIZ)
|
||||||
break;
|
break;
|
||||||
p++;
|
p++;
|
||||||
|
Loading…
Reference in New Issue
Block a user