From eb88f7e255e2dc0f4252c280120384eda015802f Mon Sep 17 00:00:00 2001 From: Carter <60557606+Carterpersall@users.noreply.github.com> Date: Fri, 9 Dec 2022 01:15:50 -0600 Subject: [PATCH] builtin: fix bug with string.split_into_lines, when lines have extra CR's at their end (#16620) --- vlib/builtin/string.v | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/vlib/builtin/string.v b/vlib/builtin/string.v index 452267708e..37d427cab6 100644 --- a/vlib/builtin/string.v +++ b/vlib/builtin/string.v @@ -849,11 +849,9 @@ pub fn (s string) split_into_lines() []string { return res } mut start := 0 - mut end := 0 for i := 0; i < s.len; i++ { if s[i] == 10 { - end = if i > 0 && s[i - 1] == 13 { i - 1 } else { i } - res << if start == end { '' } else { s[start..end] } + res << if start == i { '' } else { s[start..i].trim_right('\r') } start = i + 1 } }