From b2f86f2899b79b291eb56435f99402509105b7ec Mon Sep 17 00:00:00 2001 From: sigoden Date: Sat, 2 Mar 2024 22:02:29 +0800 Subject: refactor: auto_copy works when executing command (#328) --- src/repl/mod.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/repl') diff --git a/src/repl/mod.rs b/src/repl/mod.rs index 3edf5f6..118ff0c 100644 --- a/src/repl/mod.rs +++ b/src/repl/mod.rs @@ -273,9 +273,7 @@ impl Repl { ensure_model_capabilities(client.as_mut(), input.required_capabilities())?; let output = render_stream(&input, client.as_ref(), &self.config, self.abort.clone())?; self.config.write().save_message(input, &output)?; - if self.config.read().auto_copy { - let _ = self.copy(&output); - } + self.config.read().maybe_copy(&output); Ok(()) } @@ -352,7 +350,7 @@ Type ".help" for more information. fn copy(&self, text: &str) -> Result<()> { if text.is_empty() { - bail!("No text") + bail!("Empty text") } set_text(text)?; Ok(()) -- cgit v1.2.3