On Fri, Oct 23, 2015 at 06:32:32AM -0400, Ted Unangst wrote: > Stefan Sperling wrote: > > On Fri, Oct 23, 2015 at 05:50:53AM -0400, Ted Unangst wrote: > > > well, it doesn't work with utf-8 because it tries to underline only half > > > the > > > character. i'm aiming for the "quick fix"... > > > > Why not at least try a kind of better fix to see how it would work? > > Is this "better"? It copies the state of the previous letter to the next if > it's a utf-8 continuation byte.
Nice trick. Could the application define a macro with a meaningful name for this? > FreeBSD has full blown multibyte support as well, but it requires switching > everything to wchar_t. Which way are we going here? I think we're trying to avoid wchar_t if possible. > Index: ul.c > =================================================================== > RCS file: /cvs/src/usr.bin/ul/ul.c,v > retrieving revision 1.19 > diff -u -p -r1.19 ul.c > --- ul.c 10 Oct 2015 16:15:03 -0000 1.19 > +++ ul.c 23 Oct 2015 10:29:43 -0000 > @@ -241,6 +241,8 @@ mfilter(FILE *f) > obuf[col].c_mode |= BOLD|mode; > else > obuf[col].c_mode = mode; > + if ((c & (0x80 | 0x40)) == 0x80 && col > 0) > + obuf[col].c_mode = obuf[col - 1].c_mode; > col++; > if (col > maxcol) > maxcol = col;