fixed toggle comment shortcut detection of already commented section

This commit is contained in:
Penwing 2024-02-01 07:08:03 +01:00
parent e45ed82a29
commit 816221370a

View file

@ -385,7 +385,7 @@ impl CodeEditor {
let mut new_text: String = "".into(); let mut new_text: String = "".into();
let extend: isize; 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); extend = -self.delta_char(substring[1].clone(), head);
substring[1] = substring[1].replace(&format!("\n{}", head), "\n"); substring[1] = substring[1].replace(&format!("\n{}", head), "\n");
} else { } else {