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

Method take_input

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

Source from the content-addressed store, hash-verified

503 }
504
505 pub fn take_input(&mut self) -> String {
506 let input = std::mem::take(&mut self.input);
507 let trimmed = input.trim();
508 if !trimmed.is_empty() {
509 self.push_history(input.clone());
510 self.bump_frecency(trimmed);
511 if let Some(first) = trimmed.split_whitespace().next() {
512 if first.starts_with('/') || first.starts_with('@') {
513 self.bump_frecency(first);
514 }
515 }
516 store_history(&self.history_path, &self.history);
517 store_frecency(&self.frecency_path, &self.frecency);
518 }
519 self.cursor_position = 0;
520 self.history_index = None;
521 self.history_draft = None;
522 self.suggestions.clear();
523 self.suggestion_index = None;
524 self.mode = PromptMode::Normal;
525 self.reset_interrupt_confirmation();
526 input
527 }
528
529 pub fn clear(&mut self) {
530 self.input.clear();

Calls 8

store_historyFunction · 0.85
store_frecencyFunction · 0.85
is_emptyMethod · 0.80
push_historyMethod · 0.80
bump_frecencyMethod · 0.80
cloneMethod · 0.45
clearMethod · 0.45