-
-
Save ttdoda/a20774d9e659c693a0df to your computer and use it in GitHub Desktop.
GNU Screen: Support OSC 10 & 11 sequence (set foreground/background color)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -ur ansi.c ansi.c | |
--- ansi.c 2015-04-08 14:34:29.000000000 +0900 | |
+++ ansi.c 2016-01-19 23:23:20.000000000 +0900 | |
@@ -1554,12 +1554,12 @@ | |
} | |
#endif | |
#ifdef RXVT_OSC | |
- if (typ == 0 || typ == 1 || typ == 2 || typ == 20 || typ == 39 || typ == 49) | |
+ if (typ == 0 || typ == 1 || typ == 2 || typ == 10 || typ == 11 || typ == 20 || typ == 39 || typ == 49) | |
{ | |
int typ2; | |
typ2 = typ / 10; | |
- if (--typ2 < 0) | |
- typ2 = 0; | |
+ if (typ >= 11) | |
+ typ2++; | |
if (strcmp(curr->w_xtermosc[typ2], p)) | |
{ | |
strncpy(curr->w_xtermosc[typ2], p, sizeof(curr->w_xtermosc[typ2]) - 1); | |
@@ -1571,7 +1569,7 @@ | |
continue; | |
if (D_forecv->c_layer->l_bottom == &curr->w_layer) | |
SetXtermOSC(typ2, curr->w_xtermosc[typ2]); | |
- if ((typ2 == 2 || typ2 == 3) && D_xtermosc[typ2]) | |
+ if ((typ2 == 4 || typ2 == 5) && D_xtermosc[typ2]) | |
Redisplay(0); | |
} | |
} | |
diff -ur display.c display.c | |
--- display.c 2015-04-08 14:34:29.000000000 +0900 | |
+++ display.c 2016-01-19 23:34:03.000000000 +0900 | |
@@ -2883,6 +2883,8 @@ | |
{ | |
static char *oscs[][2] = { | |
{ WT_FLAG ";", "screen" }, /* set window title */ | |
+ { "10;", "" }, /* foreground */ | |
+ { "11;", "" }, /* background */ | |
{ "20;", "" }, /* background */ | |
{ "39;", "black" }, /* default foreground (black?) */ | |
{ "49;", "white" } /* default background (white?) */ | |
@@ -2910,7 +2911,7 @@ | |
ClearAllXtermOSC() | |
{ | |
int i; | |
- for (i = 3; i >= 0; i--) | |
+ for (i = 5; i >= 0; i--) | |
SetXtermOSC(i, 0); | |
if (D_xtermosc[0]) | |
AddStr("\033[23;" WT_FLAG "t"); /* unstack titles (xterm patch #251) */ | |
diff -ur process.c process.c | |
--- process.c 2015-04-08 14:34:29.000000000 +0900 | |
+++ process.c 2016-01-19 23:25:21.000000000 +0900 | |
@@ -7036,7 +7036,7 @@ | |
D_other = 0; | |
flayer = D_forecv->c_layer; | |
#ifdef RXVT_OSC | |
- if (D_xtermosc[2] || D_xtermosc[3]) | |
+ if (D_xtermosc[4] || D_xtermosc[5]) | |
{ | |
Activate(-1); | |
} | |
@@ -7063,7 +7063,7 @@ | |
struct win *p; | |
p = Layer2Window(D_forecv->c_layer); | |
- for (i = 3; i >=0; i--) | |
+ for (i = 5; i >=0; i--) | |
SetXtermOSC(i, p ? p->w_xtermosc[i] : 0); | |
} | |
#endif | |
diff -ur window.h window.h | |
--- window.h 2015-04-08 14:34:29.000000000 +0900 | |
+++ window.h 2016-01-19 23:29:35.000000000 +0900 | |
@@ -232,7 +232,7 @@ | |
char w_vbwait; | |
char w_norefresh; /* dont redisplay when switching to that win */ | |
#ifdef RXVT_OSC | |
- char w_xtermosc[4][MAXSTR]; /* special xterm/rxvt escapes */ | |
+ char w_xtermosc[6][MAXSTR]; /* special xterm/rxvt escapes */ | |
#endif | |
int w_mouse; /* mouse mode 0,9,1000 */ | |
#ifdef HAVE_BRAILLE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment