From 997e12cbd6cb206b83ccf6f21555d753b80f9ef9 Mon Sep 17 00:00:00 2001 From: Andrey Zgarbul Date: Fri, 25 Oct 2024 17:38:41 +0300 Subject: [PATCH] disable respace --- src/util.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/util.rs b/src/util.rs index dbf0dde5..d3a32606 100644 --- a/src/util.rs +++ b/src/util.rs @@ -148,10 +148,13 @@ pub fn sanitize_keyword(sc: Cow) -> Cow { } pub fn respace(s: &str) -> String { - s.split_whitespace() - .collect::>() - .join(" ") - .replace(r"\n", "\n") + let s = if s.matches("\n").count() == 1 { + // Special case for STM32 + s.split_whitespace().collect::>().join(" ") + } else { + s.into() + }; + s.replace(r"\n", "\n") } pub fn escape_brackets(s: &str) -> String {