From 89e18cebfac948b18a94b7b2b700bd59562f06e2 Mon Sep 17 00:00:00 2001 From: flyx Date: Sat, 22 Jan 2022 01:18:11 +0100 Subject: [PATCH] fix #105 fixed an off-by-one error when presenting folded scalars --- yaml/presenter.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yaml/presenter.nim b/yaml/presenter.nim index dcd1e5e..ad9c5d9 100644 --- a/yaml/presenter.nim +++ b/yaml/presenter.nim @@ -326,7 +326,7 @@ proc writeFolded(c: Context, scalar: string, indentation, indentStep: int, t.append(newline & newline) t.append(repeat(' ', indentation + indentStep)) curPos = indentation + indentStep - elif curPos + (word.finish - word.start) > 80: + elif curPos + (word.finish - word.start + 1) > 80: t.append(newline) t.append(repeat(' ', indentation + indentStep)) curPos = indentation + indentStep @@ -822,4 +822,4 @@ proc transform*(input: Stream | string, ss = newStringStream() c = Context(target: ss, options: options) doTransform(c, genInput(input), resolveToCoreYamlTags) - return ss.data \ No newline at end of file + return ss.data