Closed AllegroGavin closed 3 years ago
I can hit problems with backspace in the Mu REPL quite easily, but not in the python.microbit.org REPL or tera term.
This seems like a problem with Mu's handling of escape sequences.
@microbit-carlos is going to see if this is also visible on V1 with Mu - anyone who has seen it there please shout!
I gave this a go with the Mu alpha.2 release (same as @AllegroGavin, which doesn't include some of the latest changes in how it processes space sequences) and I can easily reproduce this in V2 but not in V1.
In this crude test I just type asd
as fast as i can while pressing the backspace key as well.
In V2 we can see at least 7 cases where the scape sequence is missing something and printed back:
V1 (DAPLink 0253) with twice the "samples" i couldn't get a single hit:
Actually an easier way to replicate is to fill the REPL line with text and then keep the backspace key pressed.
The incomplete scape sequence gets sometimes printed and immediately deleted, but it looks like it gets correctly processed inside the MicroPython buffer, since at some point it stops removing characters and the history (up arrow) shows an empty buffer:
Could not replicate this with V1.
This could be related to #15
In the end this was a problem on Mu that was somehow easier to trigger with V2.
The escape characters processing has been updated in the Mu repository, so it doesn't reproduce on master, but there isn't an official release yet. From the work that was carried out at the time, I think this is to do with the fact that Mu used to break up the serial processing in blocks of 20 bytes and that could divide the bytes of a scape sequence.
@AllegroGavin if you like you test a Windows CI build (down in the artifacts section) and that should should not present the issue anymore: https://github.com/mu-editor/mu/actions/runs/419131068
Yes, I can confirm the problem is no longer detectable using the new Mu build artifact version.
Thanks for looking into it!
I'm using beta.2 with Mu 1.1.0.alpha.2 on Windows 10 (have not tried beta.1) and frequently when trying to use backspace to correct input in the repl it will echo specific garbage. For example, here I have typed 12345678 and then hit backspace several times, the first few times it works correctly, then it spits out the (crossed box)[K sequence. The repl received and acted on the backspace.
It's always this same three character sequence, and it tends to occur in bursts, i.e. I can hold down backspace and maybe for 15 characters it's fine but then I get a burst of the three characters a few times in a row. It only appears to be the backspace that shows a visible issue.
I presume it's trying to output (backspace)(space)(backspace) but is glitching somehow in the serial data stream etc.