Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix buffer whitespace skip
  • Loading branch information
youknowone committed Feb 17, 2026
commit 36a53ddf6655758079f009d2e38f61c8d8df979b
10 changes: 5 additions & 5 deletions crates/vm/src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ impl FormatCode {
let mut arg_count = 0usize;
let mut codes = vec![];
while chars.peek().is_some() {
// Skip whitespace before repeat count or format char
while let Some(b' ' | b'\t' | b'\n' | b'\r') = chars.peek() {
chars.next();
}

// determine repeat operator:
let repeat = match chars.peek() {
Some(b'0'..=b'9') => {
Expand All @@ -246,11 +251,6 @@ impl FormatCode {
_ => 1,
};

// Skip whitespace (Python ignores whitespace in format strings)
while let Some(b' ' | b'\t' | b'\n' | b'\r') = chars.peek() {
chars.next();
}

// determine format char:
let c = match chars.next() {
Some(c) => c,
Expand Down