From c6e39976c63813168619e7607484887830ffd0f0 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 24 Apr 2019 20:27:52 +0000 Subject: [PATCH 1/2] Do not loop forever if there is a nonprintable character in the format. --- format-draw.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/format-draw.c b/format-draw.c index b0b050f6..51404254 100644 --- a/format-draw.c +++ b/format-draw.c @@ -837,7 +837,8 @@ format_trim_left(const char *expanded, u_int limit) *out++ = *cp; width++; cp++; - } + } else + cp++; } *out = '\0'; return (copy); @@ -883,7 +884,8 @@ format_trim_right(const char *expanded, u_int limit) *out++ = *cp; width++; cp++; - } + } else + cp++; } *out = '\0'; return (copy); From 6aa0bedad281cef0e9411f3530052d09bbc583f1 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 24 Apr 2019 20:32:31 +0000 Subject: [PATCH 2/2] Use bg not fg when adjusting for aixterm, from Ailin Nemui. --- tty.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tty.c b/tty.c index 9ed2b3a9..ff72b7da 100644 --- a/tty.c +++ b/tty.c @@ -2361,7 +2361,7 @@ tty_check_bg(struct tty *tty, struct window_pane *wp, struct grid_cell *gc) if (gc->bg & 8) { gc->bg &= 7; if (colours >= 16) - gc->fg += 90; + gc->bg += 90; } } return; @@ -2388,8 +2388,7 @@ tty_colours_fg(struct tty *tty, const struct grid_cell *gc) /* Is this an aixterm bright colour? */ if (gc->fg >= 90 && gc->fg <= 97) { - xsnprintf(s, sizeof s, "\033[%dm", gc->fg); - tty_puts(tty, s); + tty_putcode1(tty, TTYC_SETAF, gc->fg - 90 + 8); goto save_fg; } @@ -2417,8 +2416,7 @@ tty_colours_bg(struct tty *tty, const struct grid_cell *gc) /* Is this an aixterm bright colour? */ if (gc->bg >= 90 && gc->bg <= 97) { - xsnprintf(s, sizeof s, "\033[%dm", gc->bg + 10); - tty_puts(tty, s); + tty_putcode1(tty, TTYC_SETAB, gc->bg - 90 + 8); goto save_bg; }