Add breaking at line.

This commit is contained in:
Stephen Chung
2022-01-25 17:29:34 +08:00
parent 9b9cf99a8e
commit efddc7e91d
3 changed files with 185 additions and 42 deletions

View File

@@ -260,7 +260,11 @@ impl fmt::Display for Position {
impl fmt::Debug for Position {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
#[cfg(not(feature = "no_position"))]
write!(f, "{}:{}", self.line, self.pos)?;
if self.is_beginning_of_line() {
write!(f, "{}", self.line)?;
} else {
write!(f, "{}:{}", self.line, self.pos)?;
}
#[cfg(feature = "no_position")]
f.write_str("none")?;