fix: crash with ctrl-c on empty file
This commit is contained in:
parent
0f55e67576
commit
7f6265ecf3
1 changed files with 1 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue