From 19e1427d92ebc98f3f9d48945a4d2087a04d4c4d Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 30 Oct 2025 15:40:10 -0500 Subject: [PATCH] wip --- esphome/components/select/select_call.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/esphome/components/select/select_call.cpp b/esphome/components/select/select_call.cpp index 154e125eaa..aa7559e24e 100644 --- a/esphome/components/select/select_call.cpp +++ b/esphome/components/select/select_call.cpp @@ -88,17 +88,17 @@ optional SelectCall::calculate_target_index_(const char *name) { } // Use cached active_index_ instead of index_of() lookup - const auto index = this->parent_->active_index_; + const auto active_index = this->parent_->active_index_; if (this->cycle_) { - return (size + index + (this->operation_ == SELECT_OP_NEXT ? +1 : -1)) % size; + return (size + active_index + (this->operation_ == SELECT_OP_NEXT ? +1 : -1)) % size; } - if (this->operation_ == SELECT_OP_PREVIOUS && index > 0) { - return index - 1; + if (this->operation_ == SELECT_OP_PREVIOUS && active_index > 0) { + return active_index - 1; } - if (this->operation_ == SELECT_OP_NEXT && index < size - 1) { - return index + 1; + if (this->operation_ == SELECT_OP_NEXT && active_index < size - 1) { + return active_index + 1; } return {}; // Can't navigate further without cycling