From: Kevin Day Date: Wed, 31 Jan 2024 05:41:52 +0000 (-0600) Subject: Bugfix: FSS Basic List and FSS Extended List print comment at the start of the Content. X-Git-Tag: 0.6.9~35 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=3555bcc1d99834e79a5c2d72d9c3efbc42c18419;p=fll Bugfix: FSS Basic List and FSS Extended List print comment at the start of the Content. When the Content exists at the start of the Content, the comment character ('#') is printed when it should not be printed. This is a bug where the code initializes the newline_last at the range.start. The code logic then always expects the newline_last to represent an actual new line. This is not necessarily the case for when newline_last is pointing to the initial range.start position. Add a check when processing a comment to ensure that the newline_last is in fact a new line. --- diff --git a/level_1/fl_fss/c/fss/basic_list.c b/level_1/fl_fss/c/fss/basic_list.c index e91b35e..17d4bee 100644 --- a/level_1/fl_fss/c/fss/basic_list.c +++ b/level_1/fl_fss/c/fss/basic_list.c @@ -231,7 +231,14 @@ extern "C" { } if (graph_first == 0x1 && buffer.string[range->start] == f_fss_comment_s.string[0]) { - start = newline_last + 1; + + // The newline_last is initialized to the range->start, which may not actually be a new line. + if (buffer.string[newline_last] == f_string_eol_s.string[0]) { + start = newline_last + 1; + } + else { + start = newline_last; + } status = f_fss_seek_to_eol(state, buffer, range); if (F_status_is_error(status)) break; diff --git a/level_1/fl_fss/c/fss/extended_list.c b/level_1/fl_fss/c/fss/extended_list.c index f3eb721..34f88b6 100644 --- a/level_1/fl_fss/c/fss/extended_list.c +++ b/level_1/fl_fss/c/fss/extended_list.c @@ -185,7 +185,14 @@ extern "C" { } if (buffer.string[range->start] == f_fss_comment_s.string[0]) { - start = newline_last + 1; + + // The newline_last is initialized to the range->start, which may not actually be a new line. + if (buffer.string[newline_last] == f_string_eol_s.string[0]) { + start = newline_last + 1; + } + else { + start = newline_last; + } status = f_fss_seek_to_eol(state, buffer, range); if (F_status_is_error(status)) break;