Previously, when a post is being sent, the next character after a
mention was checked. If it wasn't a space, a space was added. This
implementation was insufficient because there are times where a
character immediately following a mention is desired, especially for
punctuation.
This was possible in the past because the C code counts anything non
alphanumeric as being part of the mention if it starts with 'nostr:'.
The fix included follows similar logic. If the character following the
mention is non alphanumeric, it allows it. Otherwise, a space is added
so that the C code can correctly parse the mention.
A test was added which verifies non alphanumeric characters after
mentions don't get whitespace added before them.
Fixes: af75eed ("mention: fix broken mentions when there is text is directly after")
Closes: https://github.com/damus-io/damus/issues/1915
Signed-off-by: kernelkind <kernelkind@gmail.com>
Reviewed-by: William Casarin <jb55@jb55.com>
Signed-off-by: William Casarin <jb55@jb55.com>