special = (wc == '_' && special == A_UNDERLINE)
special |= (wc == '_' && special & A_UNDERLINE)
static int format_line (struct line_t **lineInfo, int n, unsigned char *buf,			int flags, ansi_attr *pa, int cnt,			int *pspace, int *pvch, int *pcol, int *pspecial){  int space = -1; /* index of the last space or TAB */  int col = option (OPTMARKERS) ? (*lineInfo)[n].continuation : 0;  int ch, vch, k, last_special = -1, special = 0, t;  wchar_t wc;  mbstate_t mbstate;  /* FIXME: this should come from lineInfo */  memset(&mbstate, 0, sizeof(mbstate));  for (ch = 0, vch = 0; ch < cnt; ch += k, vch += k)  {    /* Handle ANSI sequences */    while (cnt-ch >= 2 && buf[ch] == '\033' && buf[ch+1] == '[' &&	   is_ansi (buf+ch+2))      ch = grok_ansi (buf, ch+2, pa) + 1;    k = mbrtowc (&wc, (char *)buf+ch, cnt-ch, &mbstate);    if (k == -2)      break;    if (k == -1)    {      if (col + 4 > COLS)	break;      col += 4;      if (pa)	printw ("\\%03o", buf[ch]);      k = 1;      continue;    }    if (k == 0)      k = 1;    /* Handle backspace */    special = 0;    if (IsWPrint (wc))    {      wchar_t wc1;      mbstate_t mbstate1;      int k1, k2;      while ((wc1 = 0, mbstate1 = mbstate,	      k1 = k + mbrtowc (&wc1, (char *)buf+ch+k, cnt-ch-k, &mbstate1),	      wc1 == '\b') &&	     (wc1 = 0,	      k2 = mbrtowc (&wc1, (char *)buf+ch+k1, cnt-ch-k1, &mbstate1),	      IsWPrint (wc1)))      {	if (wc == wc1)	{	  special = (wc == '_' && special == A_UNDERLINE)	    ? A_UNDERLINE : A_BOLD;	}	else if (wc == '_' || wc1 == '_')	{	  special = A_UNDERLINE;	  wc = (wc1 == '_') ? wc : wc1;	}	else	{	  special = 0; /* overstrike: nothing to do! */	  wc = wc1;	}	ch += k1;	k = k2;	mbstate = mbstate1;      }    }    if (pa &&	((flags & (M_SHOWCOLOR | M_SEARCH | M_PAGER_MARKER)) ||	 special || last_special || pa->attr))    {      resolve_color (*lineInfo, n, vch, flags, special, pa);      last_special = special;    }    if (IsWPrint (wc))    {      if (wc == ' ')	space = ch;      t = wcwidth (wc);      if (col + t > COLS)	break;      col += t;      if (pa)	mutt_addwch (wc);    }    else if (wc == '\n')      break;    else if (wc == '\t')    {      space = ch;      t = (col & ~7) + 8;      if (t > COLS)	break;      if (pa)	for (; col < t; col++)	  addch (' ');      else	col = t;    }    else if (wc < 0x20 || wc == 0x7f)    {      if (col + 2 > COLS)	break;      col += 2;      if (pa)	printw ("^%c", ('@' + wc) & 0x7f);    }    else if (wc < 0x100)    {      if (col + 4 > COLS)	break;      col += 4;      if (pa)	printw ("\\%03o", wc);    }    else    {      if (col + 1 > COLS)	break;      ++col;      if (pa)	addch (replacement_char ());    }  }  *pspace = space;  *pcol = col;  *pvch = vch;  *pspecial = special;  return ch;}