From: Ken Hornstein Date: Thu, 2 Jan 2014 20:04:17 +0000 (-0500) Subject: Always emit an STR instruction for terminal escape sequences, otherwise you X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/f0ee3d7fb3390b1c0a1293bfd034242872198845?ds=inline Always emit an STR instruction for terminal escape sequences, otherwise you can get unintended results (like printint the previous contents of the str register, which is almost certainly what you don't want). --- diff --git a/sbr/fmt_compile.c b/sbr/fmt_compile.c index 4ae85bc9..c4476f8d 100644 --- a/sbr/fmt_compile.c +++ b/sbr/fmt_compile.c @@ -1119,19 +1119,20 @@ get_term_stringcap(struct ftable *t, char *cap) if (termstatus == 0) initialize_terminfo(); + termcbufp = termcbuf; + if (termstatus == -1) - return; + goto out; parm = tigetstr(cap); if (parm == (char *) -1 || parm == NULL) { - return; + goto out; } - termcbufp = termcbuf; - tputs(parm, 1, termbytes); +out: termcbufp = '\0'; LS(t->f_type, termcbuf);