aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/tokenizer.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/tokenizer.rs b/src/tokenizer.rs
index de27d12..d31c8c5 100644
--- a/src/tokenizer.rs
+++ b/src/tokenizer.rs
@@ -704,7 +704,12 @@ pub fn as_codes(value: &str) -> Vec<Code> {
// Send a tab and virtual spaces.
'\t' => {
// To do: is this correct?
- let virtual_spaces = TAB_SIZE - (column % TAB_SIZE);
+ let remainder = column % TAB_SIZE;
+ let virtual_spaces = if remainder == 0 {
+ 0
+ } else {
+ TAB_SIZE - remainder
+ };
codes.push(Code::Char(char));
column += 1;
let mut index = 0;