mirror of
https://github.com/python/cpython.git
synced 2025-07-30 06:34:15 +00:00
gh-84461: Improve WebAssembly in-browser demo (GH-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>
(cherry picked from commit a8e333d79a
)
Co-authored-by: Trey Hunner <trey@treyhunner.com>
This commit is contained in:
parent
113b309f18
commit
ca58ca8641
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