Support offsetting the most recent break

This commit is contained in:
David Tolnay 2022-01-21 14:20:17 -08:00
parent 8bdf08fbed
commit 63406ac771
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -314,6 +314,12 @@ impl Printer {
}
}
pub fn offset(&mut self, offset: isize) {
if let Some(BufEntry { token: Token::Break(token), .. }) = &mut self.buf.last_mut() {
token.offset += offset;
}
}
fn check_stream(&mut self) {
while self.right_total - self.left_total > self.space {
if *self.scan_stack.front().unwrap() == self.buf.index_of_first() {