Illegal number format entry allowed in Components.Input

Issue #605 new
prl created an issue

If a Components.Input has type Input.NUMBER, it's possible to enter number strings that are not legal integer formats (i.e, not legal input values to int()).

For example, all characters can be deleted in the entry field (for any setting of Components.maxSize or Components.overwrite), and the resulting empty or all-spaces string is not a legal integer. This is the underlying cause of bug #604.

If Components.maxSize and Components.overwrite are both True (the default if Components.maxSize is True), then a delete in the middle of a number string (not the first or last digit) will insert a space in the number string (e.g, deleting the "3" in "12345" results in "12 45").

If Components.maxSize is true (and Components.overwrite has any value), if the number string is long enough, the cursor can be placed one or more spaces beyond the end of the current number string and a number entered there using any number key or UP or DOWN. The spaces will remain, so that, for example, if the last character of "1 " has "3" entered, the string becomes "1 3", which is not a legal value.

Replication steps

An empty number field can be created in media playback. Start playback of seekable media (e.g a recording) using MEDIA, navigate to recording, OK.

While the file is playing, long-FF to bring up the "Skip forward (min)" popup, then PREV to delete the string.

The other bugs can only be tested by modifying the code to use those modes for number entry in Input.

In Screens.MinuteInput.Input.__init__(),

change

        self["minutes"] = Input(str(basemins), type=Input.NUMBER)

to

        self["minutes"] = Input("%-5d" % basemins, type=Input.NUMBER, maxSize=True)

Then after restarting the GUI with the modified code, start playing a recording as above, and use long-FF to bring up the "Skip forward (min)" popup.

Then, use the number keys to enter "12345" in the input box, then move the cursor to highlight the "3", and press NEXT to delete the "3". It will be replaced by a space.

Use NEXT and PREV to delete all characters except the initial "1", so that the string is "1 " (1 followed by 4 spaces). Then use LEFT/RIGHT to move the cursor to the rightmost space and press a number key (e.g. "5"). The string will be changed to "1 5" ("1", three spaces, "5"). This can be repeated to show the same problems with UP and DOWN.

Comments (0)

  1. Log in to comment