mirror of
https://github.com/tmux/tmux.git
synced 2025-01-12 19:39:04 +00:00
A couple of fixes to the : form of SGR. Apparently there is an extra
argument that nobody knew about, so skip that if it exists. Also there are a bunch of useless optional arguments at the end, so ignore those.
This commit is contained in:
parent
c6975b3bb4
commit
051a29ca03
17
input.c
17
input.c
@ -1845,27 +1845,34 @@ input_csi_dispatch_sgr_colon(struct input_ctx *ictx, u_int i)
|
|||||||
|
|
||||||
ptr = copy = xstrdup(s);
|
ptr = copy = xstrdup(s);
|
||||||
while ((out = strsep(&ptr, ":")) != NULL) {
|
while ((out = strsep(&ptr, ":")) != NULL) {
|
||||||
|
if (*out != '\0') {
|
||||||
p[n++] = strtonum(out, 0, INT_MAX, &errstr);
|
p[n++] = strtonum(out, 0, INT_MAX, &errstr);
|
||||||
if (errstr != NULL || n == nitems(p)) {
|
if (errstr != NULL || n == nitems(p)) {
|
||||||
free(copy);
|
free(copy);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
log_debug("%s: %u = %d", __func__, n - 1, p[n - 1]);
|
log_debug("%s: %u = %d", __func__, n - 1, p[n - 1]);
|
||||||
}
|
}
|
||||||
free(copy);
|
free(copy);
|
||||||
|
|
||||||
if (n == 0 || (p[0] != 38 && p[0] != 48))
|
if (n == 0 || (p[0] != 38 && p[0] != 48))
|
||||||
return;
|
return;
|
||||||
switch (p[1]) {
|
if (p[1] == -1)
|
||||||
|
i = 2;
|
||||||
|
else
|
||||||
|
i = 1;
|
||||||
|
switch (p[i]) {
|
||||||
case 2:
|
case 2:
|
||||||
if (n != 5)
|
if (n < i + 4)
|
||||||
break;
|
break;
|
||||||
input_csi_dispatch_sgr_rgb_do(ictx, p[0], p[2], p[3], p[4]);
|
input_csi_dispatch_sgr_rgb_do(ictx, p[0], p[i + 1], p[i + 2],
|
||||||
|
p[i + 3]);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
if (n != 3)
|
if (n < i + 2)
|
||||||
break;
|
break;
|
||||||
input_csi_dispatch_sgr_256_do(ictx, p[0], p[2]);
|
input_csi_dispatch_sgr_256_do(ictx, p[0], p[i + 1]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user