From c3310327552163e2d19bea1f38287dab22d38028 Mon Sep 17 00:00:00 2001 From: Seo Sanghyeon Date: Mon, 9 May 2016 23:09:25 +0900 Subject: Better handling of tab in error --- src/libsyntax/errors/snippet/mod.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/libsyntax/errors/snippet/mod.rs') diff --git a/src/libsyntax/errors/snippet/mod.rs b/src/libsyntax/errors/snippet/mod.rs index 237e6823e0f..0699c6f4ac2 100644 --- a/src/libsyntax/errors/snippet/mod.rs +++ b/src/libsyntax/errors/snippet/mod.rs @@ -312,9 +312,15 @@ impl StyledBuffer { self.text[line][col] = chr; self.styles[line][col] = style; } else { - while self.text[line].len() < col { - self.text[line].push(' '); + let mut i = self.text[line].len(); + while i < col { + let s = match self.text[0].get(i) { + Some(&'\t') => '\t', + _ => ' ' + }; + self.text[line].push(s); self.styles[line].push(Style::NoStyle); + i += 1; } self.text[line].push(chr); self.styles[line].push(style); -- cgit 1.4.1-3-g733a5