diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-06-20 18:37:09 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-06-20 18:37:09 +0200 |
commit | e869533b99eecdc133ed3b4bedc22d24dc2c2dd9 (patch) | |
tree | f8e921c44774061e1fdca854df124caee2c637a6 /src/tokenizer.rs | |
parent | 769963fd3fe9e7027915fc0ddfc2b0e881aa6952 (diff) | |
download | markdown-rs-e869533b99eecdc133ed3b4bedc22d24dc2c2dd9.tar.gz markdown-rs-e869533b99eecdc133ed3b4bedc22d24dc2c2dd9.tar.bz2 markdown-rs-e869533b99eecdc133ed3b4bedc22d24dc2c2dd9.zip |
Fix bug with tabs
Diffstat (limited to 'src/tokenizer.rs')
-rw-r--r-- | src/tokenizer.rs | 7 |
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; |