File tree 2 files changed +17
-1
lines changed
src/features/envVisualizer
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -413,6 +413,23 @@ export function getControlItemComponent(
413
413
: index === Layout . control . size ( ) - 1 ;
414
414
if ( ! isInstr ( controlItem ) ) {
415
415
switch ( controlItem . type ) {
416
+ case 'Program' :
417
+ // If the control item is the whole program
418
+ // add {} to represent the implicit block
419
+ const originalText = astToString ( controlItem )
420
+ . trim ( )
421
+ . split ( '\n' )
422
+ . map ( line => `\t\t${ line } ` )
423
+ . join ( '\n' ) ;
424
+ const textP = `{\n${ originalText } \n}` ;
425
+ return new ControlItemComponent (
426
+ textP ,
427
+ textP ,
428
+ stackHeight ,
429
+ highlightOnHover ,
430
+ unhighlightOnHover ,
431
+ topItem
432
+ ) ;
416
433
case 'Literal' :
417
434
const textL =
418
435
typeof controlItem . value === 'string' ? `"${ controlItem . value } "` : controlItem . value ;
Original file line number Diff line number Diff line change @@ -52,7 +52,6 @@ export class Text extends Visible implements IHoverable {
52
52
? JSON . stringify ( data ) || String ( data )
53
53
: String ( data ) ;
54
54
this . _height = fontSize ;
55
-
56
55
const widthOf = ( s : string ) => getTextWidth ( s , `${ fontStyle } ${ fontSize } px ${ fontFamily } ` ) ;
57
56
if ( widthOf ( this . partialStr ) > maxWidth ) {
58
57
let truncatedText = CompactConfig . Ellipsis . toString ( ) ;
You can’t perform that action at this time.
0 commit comments