The previous patch wasn't svn style. This one is.
The previous patch wasn't svn style. This one is.
I fixed it! The patch is attached. It was an easy fix. The problem was in src/doc_text_tools.c namely a function called split_lines_backend(). It was converting byte offset to character offset when it should've been doing the opposite. Since the two are the same as long as you only use ASCII characters, the bug didn't usually show. To fix it, replace both occurrences of utf8_byteoffset_to_charsoffset_cached with utf8_charoffset_to_byteoffset_cached as shown in the patch.
Rewrap Lines broken by international characters