support user-forced line-breaks in custom block labels

Creating a custom block label-fragment named “$br” forces a new line in
all block instances. You can also select “line break” from the
label-fragment’s context menu, same as selecting a symbol.
This is really ugly, I know, I know.
But I need it to play with the micro:bit and the calliope boards.
upd4.1
Jens Mönig 2017-01-20 13:03:51 +01:00
rodzic 40150ddb78
commit dad77eb25a
2 zmienionych plików z 7 dodań i 1 usunięć

Wyświetl plik

@ -107,7 +107,7 @@ SymbolMorph, isNil, CursorMorph, VariableFrame, WatcherMorph, Variable*/
// Global stuff ////////////////////////////////////////////////////////
modules.byob = '2017-January-03';
modules.byob = '2017-January-20';
// Declarations
@ -236,6 +236,8 @@ CustomBlockDefinition.prototype.blockSpec = function () {
parts.forEach(function (part) {
if (part[0] === '%' && part.length > 1) {
spec = myself.typeOf(part.slice(1));
} else if (part === '$br') {
spec = '%br';
} else {
spec = part;
}
@ -2463,6 +2465,8 @@ BlockLabelFragmentMorph.prototype.userMenu = function () {
name
);
});
menu.addLine();
menu.addItem('\u03A0 ' + localize('line break'), 'br');
return menu;
};
@ -2922,6 +2926,7 @@ InputSlotDialogMorph.prototype.symbolMenu = function () {
'$' + symbol
]);
});
symbols.push(['\u03A0 ' + localize('line break'), 'br']);
return symbols;
};

Wyświetl plik

@ -3319,3 +3319,4 @@ Fixes:
------
* Blocks: improved inspectability of local variables
* GUI: improved library browser, thanks, Michael!
* BYOB: support user-forced line-breaks in custom block labels