1
0
mirror of https://github.com/gdamore/tcell.git synced 2025-04-24 13:48:51 +08:00

mouse demo: fix crash when multiple buttons pressed together

If we cannot decode the buttons in a drag, we might try to use '*',
which would reuslt in a negative index in the theme table.  This
only affected the demo application itself.
This commit is contained in:
Garrett D'Amore 2023-12-03 17:42:09 -08:00
parent d82c270755
commit 92c4f488a6

View File

@ -290,7 +290,7 @@ func main() {
switch ev.Buttons() {
case tcell.ButtonNone:
if ox >= 0 {
bg := theme[(lchar-'0')%8]
bg := theme[lchar%8]
fg := tcell.ColorBlack
drawBox(s, ox, oy, x, y,
up.Background(bg).Foreground(fg),