From 816221370a938f3cabdf542663ab582346303801 Mon Sep 17 00:00:00 2001 From: Penwing Date: Thu, 1 Feb 2024 07:08:03 +0100 Subject: [PATCH] fixed toggle comment shortcut detection of already commented section --- src/editor/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/editor/mod.rs b/src/editor/mod.rs index d2e561c..20d01fd 100644 --- a/src/editor/mod.rs +++ b/src/editor/mod.rs @@ -385,7 +385,7 @@ impl CodeEditor { let mut new_text: String = "".into(); let extend: isize; - if substring[1].contains(head) { + if substring[1].slice(..head.len() + 1).contains(head) { extend = -self.delta_char(substring[1].clone(), head); substring[1] = substring[1].replace(&format!("\n{}", head), "\n"); } else {