mum4k / termdash

Terminal based dashboard.
Apache License 2.0
2.69k stars 133 forks source link

Panic when attempting to use Backtab #360

Closed spacez320 closed 6 months ago

spacez320 commented 8 months ago

Pressing the 'backtab' key (a.k.a. Shift + Tab) throws an error in Termdash.

panic: unknown keyboard key '278' in a keyboard event Backtab
goroutine 31 [running]:
  internal/lib.errorTermdashHandler({0x95a4c0?, 0xc0016f5af0})
    /home/matthew/workspace/personal/cryptarch/internal/lib/display_termdash.go:59 +0x75
  github.com/mum4k/termdash.(*termdash).handleError(...)
    /home/matthew/lib/go/pkg/mod/github.com/mum4k/termdash@v0.18.0/termdash.go:250
  github.com/mum4k/termdash.(*termdash).subscribers.func1({0x95a660?, 0xc0016f5ad0?})
    /home/matthew/lib/go/pkg/mod/github.com/mum4k/termdash@v0.18.0/termdash.go:215 +0xbc
  github.com/mum4k/termdash/private/event.(*subscriber).callback(0xc00033e200, {0x95a660?, 0xc0016f5ad0?})
    /home/matthew/lib/go/pkg/mod/github.com/mum4k/termdash@v0.18.0/private/event/event.go:95 +0x31
  github.com/mum4k/termdash/private/event.(*subscriber).run(0xc00033e200, {0x95d8f0, 0xc0000940a0})
    /home/matthew/lib/go/pkg/mod/github.com/mum4k/termdash@v0.18.0/private/event/event.go:110 +0x5a
  created by github.com/mum4k/termdash/private/event.newSubscriber
    /home/matthew/lib/go/pkg/mod/github.com/mum4k/termdash@v0.18.0/private/event/event.go:89 +0x28d

This is a supported key in Tcell, at least. https://godocs.io/github.com/gdamore/tcell/v2#Key

Currently I have my program throwing away the error with a handler, but would be nice to properly support the key press.

mum4k commented 8 months ago

Thank you for reporting this @spacez320. Termdash has an intermediate terminalapi layer that allows its users to switch between different implementations (tcell Vs. termbox).

It is in this layer that keys are processed and mapped from specific implementations to Termdash implementation. Looks like all we need to do is support mapping of backtab and maybe a few additional events that were added in the meantime. The support should be added here.

Is this something you would be interested in contributing?

spacez320 commented 8 months ago

@mum4k Thanks for the response. I'd be happy to contribute this. Let me know if there's a time table, but otherwise should be able to report back soon.

mum4k commented 8 months ago

Thank you @spacez320, no rush - I don't keep any regular release schedule for Termdash. We can tag a new version once we have your PR in.

Thank you for your help!

spacez320 commented 7 months ago

Thanks @mum4k . I have a PR here: https://github.com/mum4k/termdash/pull/362, let me know how it looks.

I didn't touch termbox (it didn't seem tab was really used in that library?), let me know if I should or if I missed some events I should have implemented, or anything else.