ASCII keyboard doesn't work for FileCommander text entry

Issue #655 resolved
prl created an issue

In FileCommander.InputBoxmod.Input, ASCII characters are processed by calling Components.config.getCharValue(code), while in Components.Input, they are simply processed using unichr(code).

Most of the code in getCharValue() is dead, because the code that might enable rckeyboard_enable has been commented out.

The part of the code that is used, return unichr(getPrevAsciiCode()) is incorrect. getPrevAsciiCode() has already been called in order to get the code value passed to getCharValue() as an argument. Calling getPrevAsciiCode() returns the last value, and then sets that value to 0, so that calling getCharValue() always returns U+0000, no matter what code argument it was passed.

That inserts null a character in the input string, which is correctly preserved in the Input instance, but is treated as a string terminator by the C++ code that renders the string, so pressing any ASCII key on the keyboard appears to truncate the right-hand part of the string (although in the Python code, the string hasn't been truncated).

The bug can be fixed by changing return unichr(getPrevAsciiCode()) to return unichr(code).

However, getCharValue() is only called from FileCommander.InputBoxmod.Input in the Beyonwiz code, and isn't referenced by any code in either the enigma2-plugins or the oe-alliance-plugins repository. More tellingly, getCharValue() is not in Components.config in either the OpenViX or OpenPli source.

I recommend that instead of fixing getCharValue(code), the call to getCharValue(code) in FileCommander.InputBoxmod.Input be replaced with unichr(code), and that getCharValue(code) be removed from Components.config.

Replication steps

From live TV, MENU>Sources / Files.

Navigate to any "real" file or directory (i.e. not a name in <> brackets) and press BLUE Rename.

Use LEFT to move the cursor to be inside the string in the InputBox.

Using any ASCII keyboard, enter any printing ASCII character. Instead of inserting the character, the name appears to be truncated, removing the character under the cursor, and all characters to the right of it.

Press EXIT to exit the InputBox without performing the rename.

Comments (2)

  1. Peter Urbanec

    Sounds sensible to me. Go ahead and update the FileCommander code and then kill the dead API.

  2. Log in to comment