Merge pull request #2507 from anmolw/themes-mouse-fix

Add an out of bounds check for mouse-selected themes in +list-themes
pull/2522/head
Mitchell Hashimoto 2024-10-28 09:56:50 -07:00 committed by GitHub
commit df12e9bca5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 1 deletions

View File

@ -515,7 +515,10 @@ const Preview = struct {
}
if (theme_list.hasMouse(mouse)) |_| {
if (mouse.button == .left and mouse.type == .release) {
self.current = self.window + mouse.row;
const selection = self.window + mouse.row;
if (selection < self.filtered.items.len) {
self.current = selection;
}
}
highlight = mouse.row;
}