From c17a9f313bebe5dc705f1634138c4c8bf5b07a24 Mon Sep 17 00:00:00 2001 From: Mark Date: Fri, 4 Aug 2023 22:47:27 -0700 Subject: [PATCH] Fixed error printing --- src/main.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index d0ac3a7..699e293 100644 --- a/src/main.rs +++ b/src/main.rs @@ -46,17 +46,23 @@ pub fn do_string( } let (l, e) = r; - let t = FormattedText::new( - format!( + let mut t = FormattedText::new("".to_string()); + if l.zero() { + t.push(&format!( + "\n {}\n\n", + e.text().to_string(), + )); + } else { + t.push(&format!( concat!( "{}[e]{}[n]\n", - " {}\n" + " {}\n\n" ), " ".repeat(l.pos + 4), "^".repeat(l.len), e.text().to_string(), - ) - ); + )); + } return Err(t); }