MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / stash_current

Method stash_current

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

Source from the content-addressed store, hash-verified

595 }
596
597 pub fn stash_current(&mut self) -> bool {
598 if self.input.trim().is_empty() {
599 return false;
600 }
601
602 self.stash.push(PromptStashEntry {
603 input: self.input.clone(),
604 created_at: chrono::Utc::now().timestamp_millis(),
605 });
606 if self.stash.len() > MAX_STASH_ENTRIES {
607 let overflow = self.stash.len().saturating_sub(MAX_STASH_ENTRIES);
608 self.stash.drain(0..overflow);
609 }
610 store_stash(&self.stash_path, &self.stash);
611 self.clear();
612 true
613 }
614
615 pub fn stash_entries(&self) -> &[PromptStashEntry] {
616 &self.stash

Callers 1

Calls 4

store_stashFunction · 0.85
is_emptyMethod · 0.80
cloneMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected