make selection a const

This commit is contained in:
Anmol Wadhwani
2024-10-27 21:40:09 +05:30
parent 9190dd3ad7
commit 70d850f8e4

View File

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