mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-84461: Improve WebAssembly in-browser demo (#91879)
* Buffer standard input line-by-line * Add non-root .editorconfig for JS & HTML indent * Add support for clearing REPL with CTRL+L * Support unicode in stdout and stderr * Remove \r\n normalization * Note that local .editorconfig file extends root * Only normalize lone \r characters (convert to \n) * Skip non-printable characters in buffered input * Fix Safari bug (regex lookbehind not supported) Co-authored-by: Christian Heimes <christian@python.org>
This commit is contained in:
parent
5f2c91a343
commit
a8e333d79a
3 changed files with 99 additions and 25 deletions
|
@ -35,15 +35,11 @@ class StdinBuffer {
|
|||
}
|
||||
}
|
||||
|
||||
const stdoutBufSize = 128;
|
||||
const stdoutBuf = new Int32Array()
|
||||
let index = 0;
|
||||
|
||||
const stdout = (charCode) => {
|
||||
if (charCode) {
|
||||
postMessage({
|
||||
type: 'stdout',
|
||||
stdout: String.fromCharCode(charCode),
|
||||
stdout: charCode,
|
||||
})
|
||||
} else {
|
||||
console.log(typeof charCode, charCode)
|
||||
|
@ -54,7 +50,7 @@ const stderr = (charCode) => {
|
|||
if (charCode) {
|
||||
postMessage({
|
||||
type: 'stderr',
|
||||
stderr: String.fromCharCode(charCode),
|
||||
stderr: charCode,
|
||||
})
|
||||
} else {
|
||||
console.log(typeof charCode, charCode)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue