fix: crash with ctrl-c on empty file

pull/355/head
Blaž Hrastnik 2021-06-24 01:38:02 +09:00
parent 0f55e67576
commit 7f6265ecf3
1 changed files with 1 additions and 1 deletions

View File

@ -51,7 +51,7 @@ pub fn toggle_line_comments(doc: &Rope, selection: &Selection) -> Transaction {
let lines = start..end + 1;
let (commented, skipped, min) = find_line_comment(token, text, lines.clone());
changes.reserve(end - start - skipped.len());
changes.reserve((end - start).saturating_sub(skipped.len()));
for line in lines {
if skipped.contains(&line) {