Skip to content

Commit 36a53dd

Browse files
committed
fix buffer whitespace skip
1 parent 4b7f1f8 commit 36a53dd

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

crates/vm/src/buffer.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,11 @@ impl FormatCode {
228228
let mut arg_count = 0usize;
229229
let mut codes = vec![];
230230
while chars.peek().is_some() {
231+
// Skip whitespace before repeat count or format char
232+
while let Some(b' ' | b'\t' | b'\n' | b'\r') = chars.peek() {
233+
chars.next();
234+
}
235+
231236
// determine repeat operator:
232237
let repeat = match chars.peek() {
233238
Some(b'0'..=b'9') => {
@@ -246,11 +251,6 @@ impl FormatCode {
246251
_ => 1,
247252
};
248253

249-
// Skip whitespace (Python ignores whitespace in format strings)
250-
while let Some(b' ' | b'\t' | b'\n' | b'\r') = chars.peek() {
251-
chars.next();
252-
}
253-
254254
// determine format char:
255255
let c = match chars.next() {
256256
Some(c) => c,

0 commit comments

Comments
 (0)