From: Kevin Day Date: Wed, 31 Jan 2024 05:39:26 +0000 (-0600) Subject: Bugfix: FSS Basic List and FSS Extended List print comment at the start of the Content. X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=874de1449fbfc82e6e2b18fabc076490839c6e35;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 aab99da..b818035 100644 --- a/level_1/fl_fss/c/fss/basic_list.c +++ b/level_1/fl_fss/c/fss/basic_list.c @@ -232,7 +232,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; + } f_fss_seek_to_eol(buffer, range, state); if (F_status_is_error(state->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 755b213..1777a8e 100644 --- a/level_1/fl_fss/c/fss/extended_list.c +++ b/level_1/fl_fss/c/fss/extended_list.c @@ -187,7 +187,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; + } f_fss_seek_to_eol(buffer, range, state); if (F_status_is_error(state->status)) break;