Simplify layout of message viewer grid

This sub-grid was an artifact of an older design
This commit is contained in:
Drew DeVault 2019-06-02 09:33:41 -04:00
parent cf50b98768
commit 7f434850b5

View file

@ -91,18 +91,7 @@ func NewMessageViewer(conf *config.AercConfig,
}).At(1, 0).Span(1, 2) }).At(1, 0).Span(1, 2)
headers.AddChild(ui.NewFill(' ')).At(2, 0).Span(1, 2) headers.AddChild(ui.NewFill(' ')).At(2, 0).Span(1, 2)
body := ui.NewGrid().Rows([]ui.GridSpec{ var err error
{ui.SIZE_WEIGHT, 1},
}).Columns([]ui.GridSpec{
{ui.SIZE_WEIGHT, 1},
{ui.SIZE_EXACT, 20},
})
var (
err error
mv *MessageViewer
)
switcher := &PartSwitcher{} switcher := &PartSwitcher{}
if len(msg.BodyStructure.Parts) == 0 { if len(msg.BodyStructure.Parts) == 0 {
pv, err := NewPartViewer(conf, store, msg, msg.BodyStructure, []int{1}) pv, err := NewPartViewer(conf, store, msg, msg.BodyStructure, []int{1})
@ -132,18 +121,15 @@ func NewMessageViewer(conf *config.AercConfig,
} }
grid.AddChild(headers).At(0, 0) grid.AddChild(headers).At(0, 0)
grid.AddChild(body).At(1, 0) grid.AddChild(switcher).At(1, 0)
mv = &MessageViewer{ return &MessageViewer{
grid: grid, grid: grid,
msg: msg, msg: msg,
store: store, store: store,
switcher: switcher, switcher: switcher,
} }
body.AddChild(mv.switcher).At(0, 0).Span(1, 2)
return mv
handle_error: handle_error:
return &MessageViewer{ return &MessageViewer{
err: err, err: err,