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

Method history_previous

crates/opencode-tui/src/components/prompt.rs:644–665  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

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 {

Callers 2

handle_keyMethod · 0.80

Calls 3

is_emptyMethod · 0.80
recompute_suggestionsMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected