Skip to content

Commit 3f21686

Browse files
committed
Fixing tqdm
1 parent 37373a4 commit 3f21686

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

script.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,13 @@ async function runCodeInline() {
231231
console.log('Full output so far:', JSON.stringify(fullOutput));
232232

233233
// First, add \n after any \r that isn't already followed by \n
234-
// This ensures tqdm completion moves to new line
235234
let fixed = fullOutput.replace(/\r(?!\n)/g, '\r\n');
236235

237-
console.log('After fixing \\r:', JSON.stringify(fixed));
236+
// Special fix: detect end of tqdm (pattern like "it/s]") and add newline if not present
237+
// This ensures content after tqdm appears on new line
238+
fixed = fixed.replace(/(\d+\.\d+it\/s\])(?!\n)/g, '$1\n');
239+
240+
console.log('After fixing \\r and tqdm:', JSON.stringify(fixed));
238241

239242
// Now split by \n and process
240243
const lines = fixed.split('\n');

0 commit comments

Comments
 (0)