(&mut self)
| 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 |
no test coverage detected