Support zero skipped text in OrgSource slicing.
This commit is contained in:
parent
69512f559a
commit
b0930df788
@ -145,6 +145,9 @@ where
|
||||
if new_end > self.end {
|
||||
panic!("Attempted to extend past the end of the WrappedInput.")
|
||||
}
|
||||
if new_start == self.start && new_end == self.end {
|
||||
return self.clone();
|
||||
}
|
||||
|
||||
let skipped_text = &self.full_source[self.start..new_start];
|
||||
let mut start_of_line = self.start_of_line;
|
||||
@ -183,7 +186,7 @@ where
|
||||
start: new_start,
|
||||
end: new_end,
|
||||
start_of_line,
|
||||
preceding_character: skipped_text.chars().last(),
|
||||
preceding_character: skipped_text.chars().last().or(self.preceding_character),
|
||||
bracket_depth,
|
||||
brace_depth,
|
||||
parenthesis_depth,
|
||||
|
@ -153,7 +153,7 @@ fn _preceded_by_whitespace<'s>(
|
||||
.unwrap_or(allow_start_of_file)
|
||||
{
|
||||
return Err(nom::Err::Error(CustomError::MyError(MyError(
|
||||
"Must be preceded by a non-whitespace character.".into(),
|
||||
"Must be preceded by a whitespace character.".into(),
|
||||
))));
|
||||
}
|
||||
Ok((input, ()))
|
||||
|
Loading…
x
Reference in New Issue
Block a user