aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-10-17 15:16:11 -0500
committerRobin Jarry <robin@jarry.cc>2022-10-18 22:25:35 +0200
commitbad694e466705db83da2e864a3988255eb97055a (patch)
tree2898491fa51a998c5f034399ed17a8991abddc1b /lib
parent7016c6f86ae09b3e49eab665aa013628db4ee102 (diff)
downloadaerc-bad694e466705db83da2e864a3988255eb97055a.tar.gz
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 <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib')
-rw-r--r--lib/ui/grid.go18
1 files changed, 18 insertions, 0 deletions
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 }
}