less: fix <tab><backspace> buglet
authorDenis Vlasenko <vda.linux@googlemail.com>
Sun, 31 Dec 2006 19:36:01 +0000 (19:36 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Sun, 31 Dec 2006 19:36:01 +0000 (19:36 -0000)
miscutils/less.c

index ae936c2fbd738448d213f5c5318176c93c9828d3..20da022086953385a9ae3cf42823f4d3c212e1c7 100644 (file)
@@ -212,13 +212,13 @@ static void read_lines(void)
                                }
                        }
                        c = readbuf[readpos];
-                       /* backspace? [need this for manpage display] */
-                       if (c == '\x8' && linepos) {
+                       /* backspace? [needed for manpages] */
+                       /* <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 */
-                               /* We do not consider the case of <tab><bs> */
-                               /* Anyone who has that is pure evil :) */
                                linepos--;
-                               *p-- = '\0';
+                               *--p = '\0';
                                continue;
                        }
                        if (c == '\t')