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

Method history_next

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

Source from the content-addressed store, hash-verified

665 }
666
667 fn history_next(&mut self) {
668 let Some(idx) = self.history_index else {
669 return;
670 };
671
672 if idx + 1 < self.history.len() {
673 let next = idx + 1;
674 self.history_index = Some(next);
675 self.input = self.history[next].clone();
676 self.cursor_position = self.input.len();
677 } else {
678 self.history_index = None;
679 self.input = self.history_draft.take().unwrap_or_default();
680 self.cursor_position = self.input.len();
681 }
682 self.recompute_suggestions();
683 }
684
685 fn reset_history_cursor(&mut self) {
686 self.history_index = None;

Callers 2

handle_keyMethod · 0.80
history_next_entryMethod · 0.80

Calls 2

recompute_suggestionsMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected