less: fix <tab><backspace> buglet

This commit is contained in:
Denis Vlasenko 2006-12-31 19:36:01 +00:00
parent 95b307103a
commit 50ddabc859

View File

@ -212,13 +212,13 @@ static void read_lines(void)
} }
} }
c = readbuf[readpos]; c = readbuf[readpos];
/* backspace? [need this for manpage display] */ /* backspace? [needed for manpages] */
if (c == '\x8' && linepos) { /* <tab><bs> is (a) insane and */
/* (b) harder to do correctly, so we refuse to do it */
if (c == '\x8' && linepos && p[-1] != '\t') {
readpos++; /* eat it */ readpos++; /* eat it */
/* We do not consider the case of <tab><bs> */
/* Anyone who has that is pure evil :) */
linepos--; linepos--;
*p-- = '\0'; *--p = '\0';
continue; continue;
} }
if (c == '\t') if (c == '\t')