$NetBSD: patch-ax,v 1.2 2013/01/23 17:26:08 wiz Exp $ --- ex/ex_shift.c.orig 2007-11-19 03:41:42.000000000 +1100 +++ ex/ex_shift.c @@ -131,10 +131,13 @@ shift(SCR *sp, EXCMD *cmdp, enum which r * Build a new indent string and count the number of * characters it uses. */ - for (tbp = bp, newidx = 0; - newcol >= O_VAL(sp, O_TABSTOP); ++newidx) { - *tbp++ = '\t'; - newcol -= O_VAL(sp, O_TABSTOP); + tbp = bp; + newidx = 0; + if (!O_ISSET(sp, O_EXPANDTAB)) { + for (; newcol >= O_VAL(sp, O_TABSTOP); ++newidx) { + *tbp++ = '\t'; + newcol -= O_VAL(sp, O_TABSTOP); + } } for (; newcol > 0; --newcol, ++newidx) *tbp++ = ' ';