Skip to content
3 changes: 2 additions & 1 deletion pkgs/yaml_edit/lib/src/list_mutations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ SourceEdit _appendToBlockList(
// exists
if (list.isNotEmpty) {
final lastValueSpanEnd = list.nodes.last.span.end.offset;
final nextNewLineIndex = yaml.indexOf('\n', lastValueSpanEnd - 1);
final realEnd = yaml.substring(0, lastValueSpanEnd).trimRight().length;
final nextNewLineIndex = yaml.indexOf('\n', realEnd - 1);
Comment thread
slashblog marked this conversation as resolved.
Outdated
if (nextNewLineIndex == -1) {
formattedValue = getLineEnding(yaml) + formattedValue;
} else {
Expand Down