fixed #2108 (added drop-down menu to "letter _ of _ ")

upd4.2
jmoenig 2018-06-11 14:44:53 +02:00
rodzic 7478f6039f
commit 990ecc1eb5
3 zmienionych plików z 15 dodań i 4 usunięć

Wyświetl plik

@ -4141,3 +4141,7 @@ in development:
180609
------
* Objects, Threads: Also trigger "When I am stopped" when programmatically calling "stop all"
180611
------
* Objects, Threads: fixed #2108 (added drop-down menu to "letter _ of _ ")

Wyświetl plik

@ -83,7 +83,7 @@ BlockEditorMorph, BlockDialogMorph, PrototypeHatBlockMorph, localize,
TableMorph, TableFrameMorph, normalizeCanvas, BooleanSlotMorph, HandleMorph,
AlignmentMorph, Process, XML_Element, VectorPaintEditorMorph*/
modules.objects = '2018-June-09';
modules.objects = '2018-June-11';
var SpriteMorph;
var StageMorph;
@ -1020,7 +1020,7 @@ SpriteMorph.prototype.initBlocks = function () {
reportLetter: {
type: 'reporter',
category: 'operators',
spec: 'letter %n of %s',
spec: 'letter %idx of %s',
defaults: [1, localize('world')]
},
reportStringSize: {

Wyświetl plik

@ -62,7 +62,7 @@ StageMorph, SpriteMorph, StagePrompterMorph, Note, modules, isString, copy,
isNil, WatcherMorph, List, ListWatcherMorph, alert, console, TableMorph,
TableFrameMorph, ColorSlotMorph, isSnapObject*/
modules.threads = '2018-June-09';
modules.threads = '2018-June-11';
var ThreadManager;
var Process;
@ -2695,10 +2695,17 @@ Process.prototype.reportJoinWords = function (aList) {
// Process string ops
Process.prototype.reportLetter = function (idx, string) {
var i;
if (string instanceof List) { // catch a common user error
return '';
}
var i = +(idx || 0),
if (this.inputOption(idx) === 'any') {
idx = this.reportRandom(1, string.length);
}
if (this.inputOption(idx) === 'last') {
idx = string.length;
}
i = +(idx || 0),
str = isNil(string) ? '' : string.toString();
return str[i - 1] || '';
};