- if (ARGSFL_TABSEP == fl) {
- /* Scan ahead to tab (can't be escaped). */
- p = strchr(*v, '\t');
- pp = NULL;
-
- /* Scan ahead to unescaped `Ta'. */
- if ( ! (MDOC_PHRASELIT & m->flags))
- for (pp = *v; ; pp++) {
- if (NULL == (pp = strstr(pp, "Ta")))
- break;
- if (pp > *v && ' ' != *(pp - 1))
- continue;
- if (' ' == *(pp + 2) || '\0' == *(pp + 2))
- break;
- }
-
- /* By default, assume a phrase. */
- rc = ARGS_PHRASE;
-
- /*
- * Adjust new-buffer position to be beyond delimiter
- * mark (e.g., Ta -> end + 2).
- */
- if (p && pp) {
- *pos += pp < p ? 2 : 1;
- rc = pp < p ? ARGS_PHRASE : ARGS_PPHRASE;
- p = pp < p ? pp : p;
- } else if (p && ! pp) {
- rc = ARGS_PPHRASE;
- *pos += 1;
- } else if (pp && ! p) {
- p = pp;
- *pos += 2;
+ if (fl == ARGSFL_TABSEP) {
+ if ((p = strchr(*v, '\t')) != NULL) {
+
+ /*
+ * Words right before and right after
+ * tab characters are not parsed,
+ * unless there is a blank in between.
+ */
+
+ if (p > buf && p[-1] != ' ')
+ mdoc->flags |= MDOC_PHRASEQL;
+ if (p[1] != ' ')
+ mdoc->flags |= MDOC_PHRASEQN;
+
+ /*
+ * One or more blanks after a tab cause
+ * one leading blank in the next column.
+ * So skip all but one of them.
+ */
+
+ *pos += (int)(p - *v) + 1;
+ while (buf[*pos] == ' ' && buf[*pos + 1] == ' ')
+ (*pos)++;
+
+ /*
+ * A tab at the end of an input line
+ * switches to the next column.
+ */
+
+ if (buf[*pos] == '\0' || buf[*pos + 1] == '\0')
+ mdoc->flags |= MDOC_PHRASEQN;