walles / moar

Moar is a pager. It's designed to just do the right thing without any configuration.
Other
587 stars 17 forks source link

Crash with v1.16.1 #153

Closed walles closed 9 months ago

walles commented 9 months ago

I wasn't looking while this happened.

There is a theoretical possibility this is related to #152.

Version: v1.16.1
LANG   : sv_SE.UTF-8
TERM   : xterm-256color

GOOS    : darwin
GOARCH  : arm64
Compiler: gc
NumCPU  : 10

panic: b must be >= 0, was: -1 [recovered]
    panic: b must be >= 0, was: -1 [recovered]
    panic: b must be >= 0, was: -1

goroutine 1 [running]:
main.main.func1()
    github.com/walles/moar/moar.go:296 +0x150
panic({0x10080b2c0?, 0x1400054ab90?})
    runtime/panic.go:914 +0x218
main.startPaging.func1()
    github.com/walles/moar/moar.go:486 +0xb0
panic({0x10080b2c0?, 0x1400054ab90?})
    runtime/panic.go:914 +0x218
github.com/walles/moar/m.nonWrappingAdd(0x14000153728?, 0x1005beed4?)
    github.com/walles/moar/m/reader.go:524 +0x98
github.com/walles/moar/m.(*Reader).getLinesUnlocked(0x1400011c070, 0x100000101?, 0x0)
    github.com/walles/moar/m/reader.go:552 +0xa8
github.com/walles/moar/m.(*Reader).GetLines(0x14000156020?, 0x14000156000?, 0x14000153798?)
    github.com/walles/moar/m/reader.go:519 +0xbc
github.com/walles/moar/m.(*Pager).renderLines(0x14000156000)
    github.com/walles/moar/m/screenLines.go:142 +0xa4
github.com/walles/moar/m.(*Pager).renderScreenLines(0x14000156000)
    github.com/walles/moar/m/screenLines.go:94 +0x28
github.com/walles/moar/m.(*Pager).redraw(0x14000156000, {0x0, 0x0})
    github.com/walles/moar/m/screenLines.go:39 +0x48
github.com/walles/moar/m.(*Pager).StartPaging(0x14000156000, {0x100844e00?, 0x1400047c060})
    github.com/walles/moar/m/pager.go:484 +0x2b8
main.startPaging(0x1400011c070?, {0x100844e00?, 0x1400047c060?})
    github.com/walles/moar/moar.go:497 +0x60
main.main()
    github.com/walles/moar/moar.go:457 +0xdec
walles commented 9 months ago

Happens when you make the terminal window 1 character high.

walles commented 9 months ago

Fixed by a25c9d64774e0cef1e40be7efcee0625b9732b97.