From ed2906756bc0b424bd76306d21b01e09b1c6ef01 Mon Sep 17 00:00:00 2001 From: shy Date: Thu, 22 Apr 2021 10:12:48 +0200 Subject: [PATCH] Replace tabs by spaces. --- src/buffer.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/buffer.rs b/src/buffer.rs index bb1ce36..157a270 100644 --- a/src/buffer.rs +++ b/src/buffer.rs @@ -52,7 +52,12 @@ impl Buffer { pub fn push(&mut self, value: char) { // Reset error message. self.message = None; - self.content.push(value); + match value { + // Replace tabs by four spaces. + '\t' => self.content.push_str(" "), + // Append anything else as is. + _ => self.content.push(value), + } } // Remove last char.