From 4f20ebead36876a88391bf033d1de3e4cf0228da Mon Sep 17 00:00:00 2001 From: Wim Date: Thu, 31 Dec 2020 14:48:12 +0100 Subject: Update vendor for next release (#1343) --- .../mattermost/mattermost-server/v5/utils/markdown/lines.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'vendor/github.com/mattermost/mattermost-server/v5/utils/markdown/lines.go') diff --git a/vendor/github.com/mattermost/mattermost-server/v5/utils/markdown/lines.go b/vendor/github.com/mattermost/mattermost-server/v5/utils/markdown/lines.go index a0a64491..a67ec976 100644 --- a/vendor/github.com/mattermost/mattermost-server/v5/utils/markdown/lines.go +++ b/vendor/github.com/mattermost/mattermost-server/v5/utils/markdown/lines.go @@ -3,13 +3,16 @@ package markdown +import "strings" + type Line struct { Range } -func ParseLines(markdown string) (lines []Line) { +func ParseLines(markdown string) []Line { lineStartPosition := 0 isAfterCarriageReturn := false + lines := make([]Line, 0, strings.Count(markdown, "\n")) for position, r := range markdown { if r == '\n' { lines = append(lines, Line{Range{lineStartPosition, position + 1}}) @@ -23,5 +26,5 @@ func ParseLines(markdown string) (lines []Line) { if lineStartPosition < len(markdown) { lines = append(lines, Line{Range{lineStartPosition, len(markdown)}}) } - return + return lines } -- cgit v1.2.3