- /*
- * move one char to the right. We don't use ND space
- * because it's better to just print the char we are
- * moving over. There are various exceptions, however.
- * If !inopen, vtube contains garbage. If the char is
- * a null or a tab we want to print a space. Other random
- * chars we use space for instead, too.
- */
- if (!inopen || vtube[outline]==NULL ||
- (i=vtube[outline][outcol]) < ' ')
- i = ' ';
- if(i & QUOTE) /* mjm: no sign extension on 3B */
- i = ' ';
- if (insmode && ND)
- tputs(ND, 0, plodput);
- else
- plodput(i);
- outcol++;
+ j = destcol - outcol;
+ if (j > costRP) {
+ /*
+ * This probably happens rarely, if at all.
+ * It seems mainly useful for ANSI terminals
+ * with no hardware tabs, and I don't know
+ * of any such terminal at the moment.
+ */
+ tputs(tgoto(RIGHT_PARM, 0, j), j, plodput);
+ outcol += j;
+ }
+ else {
+ /*
+ * move one char to the right. We don't use ND space
+ * because it's better to just print the char we are
+ * moving over. There are various exceptions, however.
+ * If !inopen, vtube contains garbage. If the char is
+ * a null or a tab we want to print a space. Other
+ * random chars we use space for instead, too.
+ */
+ if (!inopen || vtube[outline]==NULL ||
+ (i=vtube[outline][outcol]) < ' ')
+ i = ' ';
+ if(i & QUOTE) /* mjm: no sign extension on 3B */
+ i = ' ';
+ if (insmode && ND)
+ tputs(ND, 0, plodput);
+ else
+ plodput(i);
+ outcol++;
+ }