gizak / termui

Golang terminal dashboard
MIT License
13.14k stars 787 forks source link

List panic due to DTrimTxCls receiving a negative w. #116

Closed james-lawrence closed 5 years ago

james-lawrence commented 7 years ago

seems related to NewCol receiving a 0 span. however negative should never be valid at this location anyways?

    debug  stack.go:24        Stack(0xbf3c40, 0xc42002e018, 0x9768c7)
    termui render.go:107      render.func1()
           panic.go:458       panic(0x895d60, 0xc4202c40b0)
    termui helper.go:200      DTrimTxCls(#1, 0xb, 0xb, 0xfffffffffffffffe, #1, 0xb, 0xb)
    termui list.go:79         (*List).Buffer(0xc42017f680, 0, 0, 0, 0, 0)
    termui grid.go:167        (*Row).Buffer(0xc420147e00, 0, 0, 0, 0, 0)
    termui grid.go:178        (*Row).Buffer(0xc420147e60, 0, 0, 0, 0, 0)
    termui grid.go:274        Grid.Buffer(0xc4202a6560, 0x2, 0x2, 0x26c, 0, 0, 0, 0, 0, 0, ...)
    termui <autogenerated>:77 (*Grid).Buffer(0xc42012bb80, 0, 0, 0, 0, 0)
    termui render.go:124      render(0xc4202a6590, 0x1, 0x1)
    termui render.go:65       Init.func2()
frodeaa commented 6 years ago

also the List will panic if height is too short

75                 if len(trimItems) > l.innerArea.Dy() {
76                         trimItems = trimItems[:l.innerArea.Dy()]
Print stack trace:

1: running [Created by termui.Init @ render.go:63]
    debug      stack.go:24     Stack(0x14dfd00, 0xc4200b0010, 0x14a73d5)
    termui     render.go:107   render.func1()
               panic.go:505    panic(0x14057e0, 0x1701440)
    termui     list.go:76      (*List).Buffer(0xc4201dc0f0, 0, 0, 0, 0, 0)
    components channels.go:123 (*Channels).Buffer(0xc4200a4300, 0, 0, 0, 0, 0)
    termui     grid.go:167     (*Row).Buffer(0xc42072e5a0, 0, 0, 0, 0, 0)
    termui     grid.go:178     (*Row).Buffer(0xc42072e660, 0, 0, 0, 0, 0)
    termui     grid.go:274     Grid.Buffer(0xc4202e8600, 0x2, 0x2, 0xcc, 0, 0, 0, 0, 0, 0, ...)
    termui     render.go:124   render(0xc420306000, 0x1, 0x1)
    termui     render.go:65    Init.func2()
cjbassi commented 5 years ago

Should be fixed now as of 958a28575d7411492d25e42da3ad5a6e5947d9a4 on master. Do note that termui has been heavily reworked in that commit, so there's a lot of breaking changes.