From bad694e466705db83da2e864a3988255eb97055a Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Mon, 17 Oct 2022 15:16:11 -0500 Subject: ui: add :split and :vsplit view options Add :split and :vsplit commands, which split the message list view to include a message viewer. Each command takes an int, or a delta value ("+1", "-1"). The int value is the resulting size of the message list, and a new message viewer will be displayed below / to the right of the message list. This viewer *does not* set seen flags. Signed-off-by: Tim Culverhouse Acked-by: Robin Jarry --- lib/ui/grid.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lib') diff --git a/lib/ui/grid.go b/lib/ui/grid.go index 76eba000..28640d03 100644 --- a/lib/ui/grid.go +++ b/lib/ui/grid.go @@ -234,6 +234,24 @@ func (grid *Grid) RemoveChild(content Drawable) { grid.Invalidate() } +func (grid *Grid) ReplaceChild(old Drawable, new Drawable) { + grid.mutex.Lock() + for i, cell := range grid.cells { + if cell.Content == old { + grid.cells[i] = &GridCell{ + RowSpan: cell.RowSpan, + ColSpan: cell.ColSpan, + Row: cell.Row, + Column: cell.Column, + Content: new, + } + break + } + } + grid.mutex.Unlock() + grid.Invalidate() +} + func Const(i int) func() int { return func() int { return i } } -- cgit