From: Apollon Oikonomopoulos Date: Wed, 10 Jul 2019 21:50:29 +0300 Subject: Fix non-ASCII description truncation Annotated descriptions with non-ASCII characters get truncated, as outlined in #820108. This happens because extractLine() keeps track of the line length in terms of displayed characters while using text.substr to extract lines, failing to account for multi-byte characters (which only increment line_length by 1). Fix this by relying on the cursor set by utf8_next_char, rather than line_length. Closes: #820108 --- src/text.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/text.cpp b/src/text.cpp index f5e3496..89f3b78 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -248,7 +248,7 @@ bool extractLine ( // Premature EOL. if (character == '\n') { - line = text.substr (offset, line_length); + line = text.substr (offset, cursor - offset - 1); offset = cursor; return true; }