Apply patches from the original repo:

- Add-support-for-DSR-response-OK-escape-sequence,
- Fixed-OSC-color-reset-without-parameter-resets-all-c
- ignore-C1-control-characters-in-UTF-8-mode
This commit is contained in:
Sergey Silaev 2023-05-30 22:36:09 +02:00
parent 956ac898e2
commit 5605f790e7
Signed by: enodllew
SSH key fingerprint: SHA256:o1kYztrHezJnX1Y3zRXSMTNhAZQmLT3jF5ZwRCskMNk
2 changed files with 17 additions and 5 deletions

View file

@ -100,7 +100,7 @@ char *termname = "st-256color";
unsigned int tabspaces = 8;
/* bg opacity */
float alpha = 0.8;
float alpha = 1.0;
/* Apprentice colorscheme */
/* Terminal colors (16 first used in escape sequence) */

20
st.c
View file

@ -1835,11 +1835,18 @@ csihandle(void)
case 'm': /* SGR -- Terminal attribute (color) */
tsetattr(csiescseq.arg, csiescseq.narg);
break;
case 'n': /* DSR Device Status Report (cursor position) */
if (csiescseq.arg[0] == 6) {
case 'n': /* DSR -- Device Status Report */
switch (csiescseq.arg[0]) {
case 5: /* Status Report "OK" `0n` */
ttywrite("\033[0n", sizeof("\033[0n") - 1, 0);
break;
case 6: /* Report Cursor Position (CPR) "<row>;<column>R" */
len = snprintf(buf, sizeof(buf), "\033[%i;%iR",
term.c.y+1, term.c.x+1);
term.c.y+1, term.c.x+1);
ttywrite(buf, len, 0);
break;
default:
goto unknown;
}
break;
case 'r': /* DECSTBM -- Set Scrolling Region */
@ -1998,8 +2005,10 @@ strhandle(void)
if (p && !strcmp(p, "?")) {
osc_color_response(j, 0, 1);
} else if (xsetcolorname(j, p)) {
if (par == 104 && narg <= 1)
if (par == 104 && narg <= 1) {
xloadcols();
return; /* color reset without parameter */
}
fprintf(stderr, "erresc: invalid color j=%d, p=%s\n",
j, p ? p : "(null)");
} else {
@ -2532,6 +2541,9 @@ check_control_code:
* they must not cause conflicts with sequences.
*/
if (control) {
/* in UTF-8 mode ignore handling C1 control characters */
if (IS_SET(MODE_UTF8) && ISCONTROLC1(u))
return;
tcontrolcode(u);
/*
* control codes are not shown ever