Skip to content

Commit

Permalink
mouse demo: fix crash when multiple buttons pressed together
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gdamore committed Dec 4, 2023
1 parent d82c270 commit 92c4f48
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion _demos/mouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 92c4f48

Please sign in to comment.