lib/kramdown/utils/string_scanner.rb in kramdown-1.3.3 vs lib/kramdown/utils/string_scanner.rb in kramdown-1.4.0

- old
+ new

@@ -36,9 +36,19 @@ def best_pos pos end end + # Sets the byte position of the scan pointer. + # + # Note: This also resets some internal variables, so always use pos= when setting the position + # and don't use any other method for that! + def pos=(pos) + super + @previous_line_number = @start_line_number + @previous_pos = 0 + end + # Returns the line number for current charpos. # # NOTE: Requires that all line endings are normalized to '\n' # # NOTE: Normally we'd have to add one to the count of newlines to get the correct line number.