Aurélien Aptel wrote: 

> Mac OSX clipping works differently and I'm not sure what to do... See
> XXX coments in nsterm.m

I fixed up the NextStep portion; attached is a new diff reflecting the changes to nsterm.m.  In particular, in ns_draw_underwave:

(1) I changed the API calls for the clipping.
(2) Because of the way the NS port handles cursor drawing, one can't extract the x-origin and width for the underwave directly from the glyph string as you did.  I made the appropriate changes.
(3) On the various displays I tried, changing wave_height from 2 to 3 dramatically improved the appearance. I took the liberty of using the latter value.  (Perhaps wave_height and wave_length should be exposed to the user as options?)  
(4) I rearranged the code to make it more obviously parallel to x_draw_underwave.