From ca0f6343f22257fbcf4cf22ce622e75bb60a93bd Mon Sep 17 00:00:00 2001 From: sigoden Date: Thu, 26 Oct 2023 21:12:02 +0800 Subject: feat: add .edit command for multi-line editing (#151) --- src/repl/validator.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/repl/validator.rs') diff --git a/src/repl/validator.rs b/src/repl/validator.rs index 1a5f405..21a7a3c 100644 --- a/src/repl/validator.rs +++ b/src/repl/validator.rs @@ -1,12 +1,13 @@ +use super::EDIT_RE; + use reedline::{ValidationResult, Validator}; /// A default validator which checks for mismatched quotes and brackets -#[allow(clippy::module_name_repetitions)] pub struct ReplValidator; impl Validator for ReplValidator { fn validate(&self, line: &str) -> ValidationResult { - if line.ends_with('\\') { + if let Ok(true) = EDIT_RE.is_match(line) { ValidationResult::Incomplete } else { ValidationResult::Complete -- cgit v1.2.3