Add better stringification for UI message types for debugging
This commit is contained in:
@ -78,7 +78,7 @@ func (be *BaseEntity) PlainText() string {
|
||||
|
||||
// String returns a textual representation of this BaseEntity struct.
|
||||
func (be *BaseEntity) String() string {
|
||||
return fmt.Sprintf(`&html.BaseEntity{Tag="%s", Style=%d, Block=%t, startX=%d, height=%d},`,
|
||||
return fmt.Sprintf(`&html.BaseEntity{Tag="%s", Style=%d, Block=%t, startX=%d, height=%d}`,
|
||||
be.Tag, be.Style, be.Block, be.startX, be.height)
|
||||
}
|
||||
|
||||
|
@ -84,12 +84,13 @@ func (ce *ContainerEntity) String() string {
|
||||
return fmt.Sprintf(`&html.ContainerEntity{Base=%s, Indent=%d, Children=[]}`, ce.BaseEntity, ce.Indent)
|
||||
}
|
||||
var buf strings.Builder
|
||||
_, _ = fmt.Fprintf(&buf, `&html.ContainerEntity{Base=%s, Indent=%d, Children=[`, ce.BaseEntity, ce.Indent)
|
||||
_, _ = fmt.Fprintf(&buf, `&html.ContainerEntity{Base=%s,
|
||||
Indent=%d, Children=[`, ce.BaseEntity, ce.Indent)
|
||||
for _, child := range ce.Children {
|
||||
buf.WriteString("\n ")
|
||||
buf.WriteString(strings.Join(strings.Split(strings.TrimRight(child.String(), "\n"), "\n"), "\n "))
|
||||
}
|
||||
buf.WriteString("\n]}\n,")
|
||||
buf.WriteString("\n]},")
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user