aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-09-05 11:57:16 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-09-05 11:57:16 +0200
commit4aa3e7fb4cf0e42fff25d836ce99a82d00cba120 (patch)
tree7f9e510ae654fb55c4f8d094121a8ec93409c472
parent44c3f10befb3f728898017b9ba9a6bc4161af799 (diff)
downloadmarkdown-rs-4aa3e7fb4cf0e42fff25d836ce99a82d00cba120.tar.gz
markdown-rs-4aa3e7fb4cf0e42fff25d836ce99a82d00cba120.tar.bz2
markdown-rs-4aa3e7fb4cf0e42fff25d836ce99a82d00cba120.zip
Fix shifting points past tabs
-rw-r--r--src/event.rs19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/event.rs b/src/event.rs
index ba266b4..fc7722d 100644
--- a/src/event.rs
+++ b/src/event.rs
@@ -1,5 +1,7 @@
//! Semantic labels of things happening.
+use crate::util::constant::TAB_SIZE;
+
/// Semantic label of a span.
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
pub enum Name {
@@ -2814,16 +2816,15 @@ impl Point {
match bytes[next.index] {
b'\n' | b'\r' => unreachable!("cannot move past line endings"),
b'\t' => {
- unreachable!("to do: tab")
- // let remainder = next.column % TAB_SIZE;
- // let vs = if remainder == 0 {
- // 0
- // } else {
- // TAB_SIZE - remainder
- // };
+ let remainder = next.column % TAB_SIZE;
+ let vs = if remainder == 0 {
+ 0
+ } else {
+ TAB_SIZE - remainder
+ };
- // next.index += 1;
- // next.column += 1 + vs;
+ next.index += 1;
+ next.column += 1 + vs;
}
_ => {
next.index += 1;