From 8de1f8b770b811084f701b9a6b9ac78ce6fa04da Mon Sep 17 00:00:00 2001 From: Laurenz Date: Thu, 4 Feb 2021 00:38:30 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20counting=20bug=20=E2=9C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/syntax/mod.rs | 2 ++ src/syntax/node.rs | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/syntax/mod.rs b/src/syntax/mod.rs index 2a8c4dbbd..af6715c6d 100644 --- a/src/syntax/mod.rs +++ b/src/syntax/mod.rs @@ -72,6 +72,8 @@ mod tests { roundtrip("```\n line \n```"); roundtrip("```\n`\n```"); roundtrip("``` ` ```"); + roundtrip("````\n```\n```\n````"); + test("```lang```", "```lang ```"); test("```1 ```", "``"); test("``` 1```", "`1`"); test("``` 1 ```", "`1 `"); diff --git a/src/syntax/node.rs b/src/syntax/node.rs index 7b6aa728f..b48660682 100644 --- a/src/syntax/node.rs +++ b/src/syntax/node.rs @@ -151,8 +151,9 @@ impl Pretty for NodeRaw { // More backticks may be required if there are lots of consecutive // backticks in the lines. - let mut count = 0; + let mut count; for line in &self.lines { + count = 0; for c in line.chars() { if c == '`' { count += 1;