summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--term.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/term.c b/term.c
index b06fe569..2795cc5c 100644
--- a/term.c
+++ b/term.c
@@ -268,22 +268,11 @@ term_fill(struct termp *p, size_t *nbr, size_t *vbr, size_t vtarget)
vis -= (*p->width)(p, p->tcol->buf[ic - 1]);
continue;
- case '\t': /* Normal ASCII whitespace. */
case ' ':
case ASCII_BREAK: /* Escape \: (breakpoint). */
- switch (p->tcol->buf[ic]) {
- case '\t':
- vn = term_tab_next(vis);
- break;
- case ' ':
- vn = vis + (*p->width)(p, ' ');
- break;
- case ASCII_BREAK:
- vn = vis;
- break;
- default:
- abort();
- }
+ vn = vis;
+ if (p->tcol->buf[ic] == ' ')
+ vn += (*p->width)(p, ' ');
/* Can break at the end of a word. */
if (breakline || vn > vtarget)
break;
@@ -317,12 +306,19 @@ term_fill(struct termp *p, size_t *nbr, size_t *vbr, size_t vtarget)
*vbr = vis;
continue;
- case ASCII_NBRSP: /* Non-breakable space. */
- p->tcol->buf[ic] = ' ';
- /* FALLTHROUGH */
- default: /* Printable character. */
+ default:
+ switch (p->tcol->buf[ic]) {
+ case '\t':
+ vis = term_tab_next(vis);
+ break;
+ case ASCII_NBRSP: /* Non-breakable space. */
+ p->tcol->buf[ic] = ' ';
+ /* FALLTHROUGH */
+ default: /* Printable character. */
+ vis += (*p->width)(p, p->tcol->buf[ic]);
+ break;
+ }
graph = 1;
- vis += (*p->width)(p, p->tcol->buf[ic]);
if (vis > vtarget && *nbr > 0)
return;
continue;