Mu: Delete key broken in REPL

Created on 6 Jan 2017  路  15Comments  路  Source: mu-editor/mu

Hi. I'm using Mu 0.9.13 on Windows. I've noticed that in the REPL, the delete key does not work as expected. Instead of erasing the character to the right of the cursor, it erases the character to the left鈥攁s if you'd pressed backspace.

In the code editor, Delete and Backspace work as normal.

Most helpful comment

I think you had a dream.

All 15 comments

this seems to be fixed in 1.0.0.alpha.2 - delete is working as expected for me

Seems be broken on 1.0.0.beta.15 on Win10x64. At least for me on 2 different computers.

Hi folks,

I just want to be very clear about what you mean here... I think I've found the problem to which you're referring @Sembazuru.

The DELETE key works correctly for all things called REPL (including the Jupyter based REPL in Python 3 mode and the serial based REPL for MicroPython based modes [Adafruit and micro:bit]). However, if you run a script in Python 3 mode, at the very end you're dropped into an interactive mode: it's in this specific case that DELETE doesn't work in that it won't delete the character immediately to the right of the cursor.

Can you confirm this is the issue you're seeing?

I have Mu configured to start in Adafruit CircuitPython mode, I really haven't used any other modes.

In the code editor the DELETE and BACKSPACE keys function as expected.

I then click the REPL button to open the REPL/Serial pane. I then press any key to "enter the REPL". I execute a command (for example help("modules")). Then I press up arrow to get the previous command and use the left arrow to move the cursor into the previous command. This is where both DELETE and BACKSPACE both function like BACKSPACE.

If the REPL is running internally on the circuit python device, the issue might actually be with the device firmware instead of Mu. Or, maybe the wrong keycode is being sent for the DELETE key? Here is the version string for the installed circuit python on my device:
Adafruit CircuitPython 2.2.4 on 2018-03-07; Adafruit Gemma M0 with samd21e18

@Sembazuru OK... you've inadvertently helped to find two bugs (the one in the Python 3 mode code runner which I mention above, and now one in MicroPython which you have described above).

Regarding the bug you mention, my best suggestion is to report it upstream here: https://github.com/micropython/micropython

I'll quickly fix the other bug in Mu.

Thanks for taking the time to give such useful feedback!

OK... a fix for Python 3 mode is in master and will be in the next release. The behaviour for the MicroPython REPL will change when upstream is fixed.

Tested this in terminal programs other than Mu REPL: Delete will delete forward if it sends 0x1B 0x4B 0x33 0x7E (ESC [ 3 ~). Backspace sends 0x7F.

Tera Term, out of the box, sends 0x08 for Backspace and 0x7F for Delete, so it only deletes backward. If I change a setting in Tera Term, I can get it to send the combinations in the paragraph above.

I don't think there's anything to change in MicroPython or CircuitPython: it supports the first-paragraph combinations properly.

Is Mu is now sending these combinations in all cases?

@dhalbert doh my bad. I'll fix. :-)

Fixed so closing. Thanks for all the contributions folks! :-)

@ntoll This hasn't been fixed for micro:bit mode, and I assume the same would apply for CircuitPython mode. I can send the "del" command using microREPL and works fine, while it doesn't with Mu.

I'm pretty certain I fixed this (I remember writing the code after @dhalbert mentioned things). I'll take another look... here's hoping I find an unmerged branch somewhere. Apologies for the confusion. ;-)

OK... @carlosperate @dhalbert -- I couldn't find the code I'd written originally, so had a real sense of deja vu with dac6c05 ;-) Who knows where the original fix went.

I think you had a dream.

That's happened before...

Thanks @ntoll!

Was this page helpful?
0 / 5 - 0 ratings