MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / toggle_selected

Method toggle_selected

crates/opencode-tui/src/components/question.rs:91–108  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

89 }
90
91 pub fn toggle_selected(&mut self) {
92 if let Some(q) = &self.current_question {
93 if q.question_type == QuestionType::MultipleChoice
94 && self.selected_index < self.selected_options.len()
95 {
96 self.selected_options[self.selected_index] =
97 !self.selected_options[self.selected_index];
98 } else if q.question_type == QuestionType::SingleChoice {
99 // For single choice, clear all and select current
100 for opt in self.selected_options.iter_mut() {
101 *opt = false;
102 }
103 if self.selected_index < self.selected_options.len() {
104 self.selected_options[self.selected_index] = true;
105 }
106 }
107 }
108 }
109
110 pub fn type_char(&mut self, c: char) {
111 if let Some(q) = &self.current_question {

Callers 2

handle_clickMethod · 0.80
handle_eventMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected