ID:2392983
 
Resolved
input() in list handled some characters badly.
BYOND Version:511
Operating System:Windows 7 Ultimate 64-bit
Web Browser:Firefox 61.0
Applies to:Dream Seeker
Status: Resolved (512.1447)

This issue has been resolved.
Descriptive Problem Summary:

input() will not default-select entries which contain apostrophes, quotes, backslashes, or open square brackets.

' " \ [ are broken.
! @ # $ % ^ & * ( ) _ : ] + = , are fine.

Must be old, so might be a dupe, but a search didn't turn up anything.

Relatedly, \ " ' are shown in the selector as \\ \" \' instead if they are the first character in the option name. Preselection failure occurs independently of this and [ does not have this problem. Selecting such an option produces an error in the output box and then reopens the selector:

Sorry, the following is not valid: \\\'
usage: [ parameter]

Or in some cases selection succeeds with the resulting text being a single \. It is not clear what causes such an option to fail silently or loudly.

Code Snippet (if applicable) to Reproduce Problem:
/var/static/all = list("Slippery Shots", "Beepsky's", "The Cavern", "The following displays wrong:", "'")

/client/var/last

/client/New()
..()
last = pick(all)
src << "Default: [last]"

/client/verb/Change()
var/choice = input(usr, "Choose", "Choose", last) as null|anything in all
if(choice)
src << "You chose: [choice]"
last = choice


Expected Results:

Using the verb to select "Beepsky's" then using the verb again again should default-select "Beepsky's".

Actual Results:

The first item in the list is default-selected instead.

Does the problem occur:
Every time? Or how often? Every time.
In other games? Yes, in a test project.
In other user accounts? Unknown.
On other computers? Unknown.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)

Occurs in 511.1385 and 512.1446.

Workarounds:

Pre-filter option names to not include such characters (interferes with grammatical correctness).
Lummox JR resolved issue with message:
input() in list handled some characters badly.