(&mut self)
| 642 | } |
| 643 | |
| 644 | fn history_previous(&mut self) { |
| 645 | if self.history.is_empty() { |
| 646 | return; |
| 647 | } |
| 648 | match self.history_index { |
| 649 | Some(idx) => { |
| 650 | if idx > 0 { |
| 651 | self.history_index = Some(idx - 1); |
| 652 | } |
| 653 | } |
| 654 | None => { |
| 655 | self.history_draft = Some(self.input.clone()); |
| 656 | self.history_index = Some(self.history.len() - 1); |
| 657 | } |
| 658 | } |
| 659 | |
| 660 | if let Some(idx) = self.history_index { |
| 661 | self.input = self.history[idx].clone(); |
| 662 | self.cursor_position = self.input.len(); |
| 663 | self.recompute_suggestions(); |
| 664 | } |
| 665 | } |
| 666 | |
| 667 | fn history_next(&mut self) { |
| 668 | let Some(idx) = self.history_index else { |
no test coverage detected