Skip to content

Conversation

treyhunner
Copy link

It took me a while to figure out what to hook into, but I believe I finally got standard input working the way I'd expect it to.

Improvements:

  1. When multi-line text is pasted it displays as expected and also runs as expected
  2. When text is typed while code is currently running, the typed text shows up only when standard input is prompt again
  3. Partial data (when the pasted text doesn't end in a newline or when some text is typed and then some is pasted) shows up as expected

I added a separate class because the code started to feel unwieldy after I initially added all the buffering to the existing class. Happy to refactor if desired.

This along with unicode support (there's another PR for that) make this REPL feel pretty much like a native one from my testing (just need to add support for using Ctrl+L to clear the screen). 😁

@tiran
Copy link
Collaborator

tiran commented Apr 24, 2022

I merged the browser-ui into CPython repo a while ago. Could you please make a PR against https://github.com/python/cpython/blob/main/Tools/wasm/python.html ?

@treyhunner
Copy link
Author

@tiran I just opened a pull request. 👍 You might want to update the README file here to note that important changes should be made to the cpython repo instead/additionally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants