From 06823fbf1c2e763a5bf76c3990ca98fbbcd98691 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Tue, 14 May 2024 14:05:49 +0800 Subject: updated node_modules --- .../yaml/browser/dist/stringify/foldFlowLines.js | 29 ++++++++++++++-------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'node_modules/yaml/browser/dist/stringify/foldFlowLines.js') diff --git a/node_modules/yaml/browser/dist/stringify/foldFlowLines.js b/node_modules/yaml/browser/dist/stringify/foldFlowLines.js index 01fe7876..2a554266 100644 --- a/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +++ b/node_modules/yaml/browser/dist/stringify/foldFlowLines.js @@ -28,7 +28,7 @@ function foldFlowLines(text, indent, mode = 'flow', { indentAtStart, lineWidth = let escStart = -1; let escEnd = -1; if (mode === FOLD_BLOCK) { - i = consumeMoreIndentedLines(text, i); + i = consumeMoreIndentedLines(text, i, indent.length); if (i !== -1) end = i + endStep; } @@ -52,8 +52,8 @@ function foldFlowLines(text, indent, mode = 'flow', { indentAtStart, lineWidth = } if (ch === '\n') { if (mode === FOLD_BLOCK) - i = consumeMoreIndentedLines(text, i); - end = i + endStep; + i = consumeMoreIndentedLines(text, i, indent.length); + end = i + indent.length + endStep; split = undefined; } else { @@ -121,15 +121,24 @@ function foldFlowLines(text, indent, mode = 'flow', { indentAtStart, lineWidth = * Presumes `i + 1` is at the start of a line * @returns index of last newline in more-indented block */ -function consumeMoreIndentedLines(text, i) { - let ch = text[i + 1]; +function consumeMoreIndentedLines(text, i, indent) { + let end = i; + let start = i + 1; + let ch = text[start]; while (ch === ' ' || ch === '\t') { - do { - ch = text[(i += 1)]; - } while (ch && ch !== '\n'); - ch = text[i + 1]; + if (i < start + indent) { + ch = text[++i]; + } + else { + do { + ch = text[++i]; + } while (ch && ch !== '\n'); + end = i; + start = i + 1; + ch = text[start]; + } } - return i; + return end; } export { FOLD_BLOCK, FOLD_FLOW, FOLD_QUOTED, foldFlowLines }; -- cgit v1.2.3