There's two way to terinate an OSC: ST (\033\\) or BEL (\a). Use whatever the original request used instead of always forcing a BEL.
Signed-off-by: Lubomir Rintel <lkund...@v3.sk> (cherry picked from commit 11a74b838216bf3c90eb4c3369592f2632838095) --- src/ansi.c | 7 ++++++- src/display.c | 7 ++++--- src/extern.h | 2 +- src/process.c | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/ansi.c b/src/ansi.c index 28e3529..e0ba627 100644 --- a/src/ansi.c +++ b/src/ansi.c @@ -1522,6 +1522,11 @@ StringEnd() struct canvas *cv; char *p; int typ; + char *t; + + /* There's two ways to terminate an OSC. If we've seen an ESC + * then it's been ST otherwise it's BEL. */ + t = curr->w_state == STRESC ? "\033\\" : "\a"; curr->w_state = LIT; *curr->w_stringp = '\0'; @@ -1579,7 +1584,7 @@ StringEnd() if (!D_CXT) continue; if (D_forecv->c_layer->l_bottom == &curr->w_layer) - SetXtermOSC(typ2, p); + SetXtermOSC(typ2, p, t); if ((typ2 == 3 || typ2 == 4) && D_xtermosc[typ2]) Redisplay(0); if (typ == 11 && !strcmp("?", p)) diff --git a/src/display.c b/src/display.c index dbc7d74..79155b8 100644 --- a/src/display.c +++ b/src/display.c @@ -2933,9 +2933,10 @@ int newtop, newbot; #define WT_FLAG "2" /* change to "0" to set both title and icon */ void -SetXtermOSC(i, s) +SetXtermOSC(i, s, t) int i; char *s; +char *t; { static char *oscs[][2] = { { WT_FLAG ";", "screen" }, /* set window title */ @@ -2960,7 +2961,7 @@ char *s; AddStr("\033]"); AddStr(oscs[i][0]); AddStr(s); - AddChar(7); + AddStr(t); } void @@ -2968,7 +2969,7 @@ ClearAllXtermOSC() { int i; for (i = 4; i >= 0; i--) - SetXtermOSC(i, 0); + SetXtermOSC(i, 0, "\a"); if (D_xtermosc[0]) AddStr("\033[23;" WT_FLAG "t"); /* unstack titles (xterm patch #251) */ } diff --git a/src/extern.h b/src/extern.h index 0701bf5..bb7d3fb 100644 --- a/src/extern.h +++ b/src/extern.h @@ -308,7 +308,7 @@ extern void NukePending __P((void)); #endif #ifdef RXVT_OSC extern void ClearAllXtermOSC __P((void)); -extern void SetXtermOSC __P((int, char *)); +extern void SetXtermOSC __P((int, char *, char *)); #endif #ifdef COLOR extern int color256to16 __P((int)); diff --git a/src/process.c b/src/process.c index 3c7cce8..dcb3989 100644 --- a/src/process.c +++ b/src/process.c @@ -7191,7 +7191,7 @@ RefreshXtermOSC() p = Layer2Window(D_forecv->c_layer); for (i = 4; i >=0; i--) - SetXtermOSC(i, p ? p->w_xtermosc[i] : 0); + SetXtermOSC(i, p ? p->w_xtermosc[i] : 0, "\a"); } #endif -- 2.17.1