File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -545,11 +545,12 @@ impl Cursor<'_> {
545545
546546 let mut s = self . as_str ( ) ;
547547 let mut found = false ;
548+ let mut size = 0 ;
548549 while let Some ( closing) = s. find ( & "-" . repeat ( length_opening as usize ) ) {
549550 let preceding_chars_start = s[ ..closing] . rfind ( "\n " ) . map_or ( 0 , |i| i + 1 ) ;
550551 if s[ preceding_chars_start..closing] . chars ( ) . all ( is_whitespace) {
551552 // candidate found
552- self . bump_bytes ( closing) ;
553+ self . bump_bytes ( size + closing) ;
553554 // in case like
554555 // ---cargo
555556 // --- blahblah
@@ -562,6 +563,7 @@ impl Cursor<'_> {
562563 break ;
563564 } else {
564565 s = & s[ closing + length_opening as usize ..] ;
566+ size += closing + length_opening as usize ;
565567 }
566568 }
567569
Original file line number Diff line number Diff line change 1+ ---
2+ x ---🚧️
3+ ---
4+
5+ // Regression test for #141483
6+ //@check-pass
7+
8+ #![ feature ( frontmatter) ]
9+
10+ fn main ( ) { }
Original file line number Diff line number Diff line change 1+ ---
2+ x ---y
3+ ---
4+
5+ // Test that hypens are allowed inside frontmatters if there is some
6+ // non-whitespace character preceding them.
7+ //@check-pass
8+
9+ #![ feature ( frontmatter) ]
10+
11+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments