bbcmicrobit / PythonEditor

A MicroPython editor for the BBC micro:bit that works with browsers.
https://python.microbit.org/
MIT License
198 stars 130 forks source link

WebUSB: Always reset the serial terminal when closed #312

Closed microbit-carlos closed 4 years ago

microbit-carlos commented 4 years ago

It does this by refactoring the "serial close" code from multiple places into a single function.

By leaving the content of the terminal when closing the serial it might look like the REPL is still running, which it isn't after a serial reconnection.

In this GIF you can see me opening the REPL, execute a command, and then trying to go back and press the UP key in the keyboard to try to repeat the last command. Every time the UP key is pressed we can see an error in the console (different issue), and it isn't until Ctrl+C is pressed that the REPL is running again.

ezgif-2-48539878020a

I think this also possibly fixes the issue that was reported by some users where typing in the terminal would print on the screen the same character multiple times.

microbit-carlos commented 4 years ago

@microbit-sam could you review when you find some time after everything else? This is very low priority at the moment.