mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-09-02 15:07:28 -04:00
Calculate block width from BlockStack & RenderContext
This commit is contained in:
@@ -51,6 +51,13 @@ func (s BlockStack) Margin() uint {
|
||||
return i
|
||||
}
|
||||
|
||||
func (s BlockStack) Width(ctx RenderContext) uint {
|
||||
if s.Indent()+s.Margin()*2 > uint(ctx.options.WordWrap) {
|
||||
return 0
|
||||
}
|
||||
return uint(ctx.options.WordWrap) - s.Indent() - s.Margin()*2
|
||||
}
|
||||
|
||||
func (s BlockStack) Parent() BlockElement {
|
||||
if len(s) < 2 {
|
||||
return s.Current()
|
||||
|
||||
Reference in New Issue
Block a user