It is based on the wcswidth implementation that you linked to.
> I think a better specification would be given that we have a floating reference to UAX44,
> to say that codepoints that have the Unicode property "Emoji_Presentation" or
> East_Asian_Width="W" have a width of 2.
Not all emoji have a width of 2 and I'm not sure about East_Asian_Width being a reliable indicator either so if anyone is interested in writing a paper to improve width estimation (I'm not) at the very least I'd recommend checking presentations on several popular terminals.
Cheers,
Victor