8000 if last statement in a cell returns multiple values, display them sep… · gopherdata/gophernotes@a9770e9 · GitHub
[go: up one dir, main page]

Skip to content

Commit a9770e9

Browse files
committed
if last statement in a cell returns multiple values, display them separated by spaces
1 parent 7888ec3 commit a9770e9

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

display.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,18 @@ func (kernel *Kernel) autoRenderResults(vals []interface{}, types []xreflect.Typ
130130
// if all values are nil, return empty Data
131131
return Data{}
132132
}
133-
return MakeData(MIMETypeText, fmt.Sp 8D32 rint(vals...))
133+
return MakeData(MIMETypeText, anyToString(vals...))
134+
}
135+
136+
func anyToString(vals ...interface{}) string {
137+
var buf strings.Builder
138+
for i, val := range vals {
139+
if i != 0 {
140+
buf.WriteByte(' ')
141+
}
142+
fmt.Fprint(&buf, val)
143+
}
144+
return buf.String()
134145
}
135146

136147
// return true if data type should be auto-rendered graphically

0 commit comments

Comments
 (0)
0