From: Kevin Day Date: Fri, 1 Mar 2024 05:01:24 +0000 (-0600) Subject: Bugfix: If the first character has a width greater than one then F_utf_fragment is... X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=23c483e13777e4fa341f553e183e0217dbac91af;p=fll Bugfix: If the first character has a width greater than one then F_utf_fragment is incorrectly returned when using quotes. A F_utf_fragment is incorrectly when writing a string that would use quotes and that first character has a width greater than one. The code is incrementing the string by 1. This should instead be incrementing by the character width. The loop itself should increment by the character width as well. This bug has been exposed by unit tests. --- diff --git a/level_1/fl_fss/c/private-fss.c b/level_1/fl_fss/c/private-fss.c index 6809e6a..c07423a 100644 --- a/level_1/fl_fss/c/private-fss.c +++ b/level_1/fl_fss/c/private-fss.c @@ -1105,7 +1105,7 @@ extern "C" { // The start quote may or may not need to be delimited in this case. if (destination->string[input_start] == quote_char) { - for (i = input_start + 1; i <= range->stop && i < object.used; ++i) { + for (i = input_start + macro_f_utf_byte_width(object.string[input_start]); i <= range->stop && i < object.used; i += macro_f_utf_byte_width(object.string[i])) { if (state->interrupt) { state->interrupt((void *) state, internal);