Skip to content

Commit 92c4f48

Browse files
committed
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.
1 parent d82c270 commit 92c4f48

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

_demos/mouse.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ func main() {
290290
switch ev.Buttons() {
291291
case tcell.ButtonNone:
292292
if ox >= 0 {
293-
bg := theme[(lchar-'0')%8]
293+
bg := theme[lchar%8]
294294
fg := tcell.ColorBlack
295295
drawBox(s, ox, oy, x, y,
296296
up.Background(bg).Foreground(fg),

0 commit comments

Comments
 (0)