From 048e72abf517fd9fb7d7ae66c1eb533d2897d797 Mon Sep 17 00:00:00 2001 From: TcMits Date: Tue, 9 Sep 2025 16:27:31 +0700 Subject: [PATCH] consume remaining --- cli/app.rs | 6 +++++- cli/main.rs | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cli/app.rs b/cli/app.rs index 54c282749..92371f5b1 100644 --- a/cli/app.rs +++ b/cli/app.rs @@ -484,7 +484,7 @@ impl Limbo { } // consume will consume `input_buff` - pub fn consume(&mut self) -> anyhow::Result<()> { + pub fn consume(&mut self, flush: bool) -> anyhow::Result<()> { if self.input_buff.trim().is_empty() { return Ok(()); } @@ -503,6 +503,10 @@ impl Limbo { self.run_query(value); self.reset_input(); } + (false, false) if flush => { + self.run_query(value); + self.reset_input(); + } (false, false) => { self.set_multiline_prompt(); } diff --git a/cli/main.rs b/cli/main.rs index d1ea807e3..affb73888 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -64,7 +64,7 @@ fn main() -> anyhow::Result<()> { loop { match app.readline() { - Ok(_) => match app.consume() { + Ok(_) => match app.consume(false) { Ok(_) => {} Err(e) => { eprintln!("{e}"); @@ -83,7 +83,7 @@ fn main() -> anyhow::Result<()> { } Err(ReadlineError::Eof) => { // consume remaining input before exit - match app.consume() { + match app.consume(true) { Ok(_) => {} Err(e) => { eprintln!("{e}");