Patrick Rein uploaded a new version of CommandLine to project The Trunk:
http://source.squeak.org/trunk/CommandLine-TheresaHMartenK.17.mcz==================== Summary ====================
Name: CommandLine-TheresaHMartenK.17
Author: TheresaHMartenK
Time: 20 June 2020, 4:33:21.503561 pm
UUID: 1e990100-46c5-7b4a-966c-d1908837d2ca
Ancestors: CommandLine-mt.16
Same reason as: ToolBuilder-Morphic-TheresaHMartenK.261
Copy:
The current implementation searches for the supplied answer in the valueList and if found returns the value at the found index in the valueList which of course is the supplied answer. However from the behaviour that gets mimicked you would expect the implementation to look for the suppliedAnswer in the labelList - the same as you click on the label and not on its connected value. Additionally this produces less readable / understandable code compared to supplying the label, especially if the value happens to be a block.
With the new implementation, the answer is searched in the labelList, and the returned value is the coresponding value from the valueList.
=============== Diff against CommandLine-mt.16 ===============
Item was changed:
----- Method: DummyUIManager>>chooseFrom:values:lines:title: (in category 'ui requests') -----
chooseFrom: labelList values: valueList lines: linesArray title: aString
self askForProvidedAnswerTo: aString ifSupplied: [:answer |
(answer = #cancel or: [answer isNil]) ifTrue: [^ nil].
+ ^ valueList at: (labelList indexOf: answer) ifAbsent: [
- ^ valueList at: (valueList indexOf: answer) ifAbsent: [
answer isNumber
ifTrue: [valueList at: answer ifAbsent: [nil]]
ifFalse: [nil]]].
^ valueList first!