Handle a key event. Returns a QuestionAction.
(&mut self, key: KeyEvent)
| 208 | |
| 209 | /// Handle a key event. Returns a QuestionAction. |
| 210 | pub fn handle_key_event(&mut self, key: KeyEvent) -> QuestionAction { |
| 211 | if key.kind != KeyEventKind::Press && key.kind != KeyEventKind::Repeat { |
| 212 | return QuestionAction::None; |
| 213 | } |
| 214 | |
| 215 | // Custom text editing mode |
| 216 | if self.editing_custom && !self.on_confirm_page() { |
| 217 | return self.handle_editing_key(key); |
| 218 | } |
| 219 | |
| 220 | // Confirm page |
| 221 | if self.on_confirm_page() { |
| 222 | return self.handle_confirm_key(key); |
| 223 | } |
| 224 | |
| 225 | // Normal question selection |
| 226 | self.handle_question_key(key) |
| 227 | } |
| 228 | |
| 229 | /// Handle keys when editing custom "Other" text |
| 230 | fn handle_editing_key(&mut self, key: KeyEvent) -> QuestionAction { |
no test coverage detected