Better doc for Merge wrapper
Vladimir Bauer
6 years ago
| 4 | 4 | "unicode/utf8" |
| 5 | 5 | ) |
| 6 | 6 | |
| 7 | // Merge helper func, provides a way to synchronize width of single | |
| 8 | // decorator with adjacent decorators of different bar, like so: | |
| 9 | // +--------+---------+ | |
| 10 | // | MERGE(D) | | |
| 11 | // +--------+---------+ | |
| 12 | // | D1 | D2 | | |
| 13 | // +--------+---------+ | |
| 7 | // Merge wraps its decorator argument with intention to sync width | |
| 8 | // with several decorators of another bar. Visual example: | |
| 9 | // | |
| 10 | // +----+--------+---------+--------+ | |
| 11 | // | B1 | MERGE(D, P1, Pn) | | |
| 12 | // +----+--------+---------+--------+ | |
| 13 | // | B2 | D0 | D1 | Dn | | |
| 14 | // +----+--------+---------+--------+ | |
| 14 | 15 | // |
| 15 | 16 | func Merge(decorator Decorator, placeholders ...WC) Decorator { |
| 16 | 17 | if _, ok := decorator.Sync(); !ok || len(placeholders) == 0 { |
| 37 | 38 | placeHolders []*placeHolderDecorator |
| 38 | 39 | } |
| 39 | 40 | |
| 40 | func (d *mergeDecorator) CompoundDecorators() []Decorator { | |
| 41 | func (d *mergeDecorator) MergeUnwrap() []Decorator { | |
| 41 | 42 | decorators := make([]Decorator, len(d.placeHolders)+1) |
| 42 | 43 | decorators[0] = d.Decorator |
| 43 | 44 | for i, ph := range d.placeHolders { |