Calculate block width from BlockStack & RenderContext

This commit is contained in:
Christian Muehlhaeuser
2019-12-07 19:49:24 +01:00
parent 7404a91eb4
commit 71e84251b3
8 changed files with 41 additions and 37 deletions
+1 -2
View File
@@ -6,7 +6,6 @@ import (
)
type DocumentElement struct {
Width uint
}
func (e *DocumentElement) Render(w io.Writer, ctx RenderContext) error {
@@ -37,7 +36,7 @@ func (e *DocumentElement) Finish(w io.Writer, ctx RenderContext) error {
suffix := rules.Suffix
pw := &PaddingWriter{
Padding: e.Width - margin,
Padding: uint(ctx.options.WordWrap) - margin,
PadFunc: func(wr io.Writer) {
renderText(w, rules, " ")
},