From 9b24f83456d02954d0b5fcd6ab081cf61738cda3 Mon Sep 17 00:00:00 2001 From: Irevoire Date: Tue, 9 Nov 2021 10:27:29 +0100 Subject: [PATCH] in case of error return a range of chars position instead of one line and column --- filter_parser/src/error.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/filter_parser/src/error.rs b/filter_parser/src/error.rs index b162fb554..4580cde4f 100644 --- a/filter_parser/src/error.rs +++ b/filter_parser/src/error.rs @@ -146,12 +146,8 @@ impl<'a> Display for Error<'a> { )?, ErrorKind::External(ref error) => writeln!(f, "{}", error)?, } - write!( - f, - "{}:{} in `{}`.", - self.context.location_line(), - self.context.get_utf8_column(), - self.context.extra, - ) + let base_column = self.context.get_utf8_column(); + let size = self.context.fragment().chars().count(); + write!(f, "{}:{} in `{}`.", base_column, base_column + size, self.context.extra,) } }