From c9300ec35f1baeab92a5375814b91bb81c66de73 Mon Sep 17 00:00:00 2001 From: Nathan Vegdahl Date: Tue, 20 Jul 2021 12:23:40 -0700 Subject: Fix comment toggle command also sometimes toggling the next line. --- helix-core/src/comment.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'helix-core/src/comment.rs') diff --git a/helix-core/src/comment.rs b/helix-core/src/comment.rs index 5d564055..4fcece57 100644 --- a/helix-core/src/comment.rs +++ b/helix-core/src/comment.rs @@ -46,8 +46,7 @@ pub fn toggle_line_comments(doc: &Rope, selection: &Selection, token: Option<&st let comment = Tendril::from(format!("{} ", token)); for selection in selection { - let start = text.char_to_line(selection.from()); - let end = text.char_to_line(selection.to()); + let (start, end) = selection.line_range(text); let lines = start..end + 1; let (commented, skipped, min) = find_line_comment(&token, text, lines.clone()); -- cgit v1.2.3-70-g09d2