From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (schwarze@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id o7KNY2aV010978 for ; Fri, 20 Aug 2010 19:34:02 -0400 (EDT) Received: (from schwarze@localhost) by krisdoz.my.domain (8.14.3/8.14.3/Submit) id o7KNY2No011286; Fri, 20 Aug 2010 19:34:02 -0400 (EDT) Date: Fri, 20 Aug 2010 19:34:02 -0400 (EDT) Message-Id: <201008202334.o7KNY2No011286@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Centralize handling of literal tabs in term_flushln() in one X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Centralize handling of literal tabs in term_flushln() in one place, making the code simpler and easier to understand. No functional change. Modified Files: -------------- mdocml: term.c Revision Data ------------- Index: term.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/term.c,v retrieving revision 1.168 retrieving revision 1.169 diff -Lterm.c -Lterm.c -u -p -r1.168 -r1.169 --- term.c +++ term.c @@ -169,12 +169,11 @@ term_flushln(struct termp *p) * Handle literal tab characters: collapse all * subsequent tabs into a single huge set of spaces. */ - for (j = i; j < (int)p->col; j++) { - if ('\t' != p->buf[j]) - break; + while (i < (int)p->col && '\t' == p->buf[i]) { vend = (vis / p->tabwidth + 1) * p->tabwidth; vbl += vend - vis; vis = vend; + i++; } /* @@ -185,7 +184,7 @@ term_flushln(struct termp *p) */ /* LINTED */ - for (jhy = 0; j < (int)p->col; j++) { + for (j = i, jhy = 0; j < (int)p->col; j++) { if ((j && ' ' == p->buf[j]) || '\t' == p->buf[j]) break; @@ -227,12 +226,6 @@ term_flushln(struct termp *p) p->overstep; p->overstep = 0; } - - /* - * Skip leading tabs, they were handled above. - */ - while (i < (int)p->col && '\t' == p->buf[i]) - i++; /* Write out the [remaining] word. */ for ( ; i < (int)p->col; i++) { -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv