summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorConnor Kuehl <cipkuehl@gmail.com>2022-04-27 19:46:03 -0500
committerRobin Jarry <robin@jarry.cc>2022-04-28 17:56:37 +0200
commit01528ae1e2f6d133566a612b1c0e72b363b56868 (patch)
tree486dc13661d1ec69a3230a1ec18070679591607d /lib
parent8ed95b0d2ad287a7a78b5dfcf95795ab6c8ccd2b (diff)
downloadaerc-01528ae1e2f6d133566a612b1c0e72b363b56868.zip
grid: don't draw at a negative offset
aerc panics when using macOS's default terminal emulator, Terminal.app, when closing all but aerc's tab: This error was also written to: /tmp/aerc-crash-20220427-194134.log panic: Attempted to create context with negative offset [recovered] panic: Attempted to create context with negative offset goroutine 1 [running]: git.sr.ht/~rjarry/aerc/logging.PanicHandler() /Users/ckuehl/src/aerc/logging/panic-logger.go:47 +0x58c panic({0x100d077a0, 0x14000032700}) /opt/homebrew/Cellar/go/1.18.1/libexec/src/runtime/panic.go:844 +0x258 git.sr.ht/~rjarry/aerc/lib/ui.(*Context).Subcontext(0x1400013e420?, 0x14000202360?, 0x140000ffc48?, 0x1009a10e4?, 0x100da9440?) /Users/ckuehl/src/aerc/lib/ui/context.go:47 +0x160 git.sr.ht/~rjarry/aerc/lib/ui.(*Grid).Draw(0x1400013e420, 0x14000202360) /Users/ckuehl/src/aerc/lib/ui/grid.go:143 +0x2bc git.sr.ht/~rjarry/aerc/widgets.(*Aerc).Draw(0x1400013e4d0, 0x14000202360) /Users/ckuehl/src/aerc/widgets/aerc.go:178 +0x30 git.sr.ht/~rjarry/aerc/lib/ui.(*UI).Tick(0x1400022bcc0) /Users/ckuehl/src/aerc/lib/ui/ui.go:116 +0x248 main.main() /Users/ckuehl/src/aerc/aerc.go:226 +0x9e8 I'm not entirely sure what the interactions are between the terminal emulator, aerc's grid, and the space that moves around when the tab bar disappears because there are no more tabs, but this fixes the issue 100% of the time and I haven't noticed any issues. Signed-off-by: Connor Kuehl <cipkuehl@gmail.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'lib')
-rw-r--r--lib/ui/grid.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/ui/grid.go b/lib/ui/grid.go
index f505ce0..2d19571 100644
--- a/lib/ui/grid.go
+++ b/lib/ui/grid.go
@@ -123,6 +123,10 @@ func (grid *Grid) Draw(ctx *Context) {
cols := grid.columnLayout[cell.Column : cell.Column+cell.ColSpan]
x := cols[0].Offset
y := rows[0].Offset
+ if x < 0 || y < 0 {
+ continue
+ }
+
width := 0
height := 0
for _, col := range cols {