aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src/comment.rs
diff options
context:
space:
mode:
authorNathan Vegdahl2021-07-20 19:23:40 +0000
committerNathan Vegdahl2021-07-20 19:23:40 +0000
commitc9300ec35f1baeab92a5375814b91bb81c66de73 (patch)
tree08703716328b684b12ab24f53df94c5fefa70587 /helix-core/src/comment.rs
parent1c6b5581f01371a00dc7f6f6e1720ad8af61ec7a (diff)
Fix comment toggle command also sometimes toggling the next line.
Diffstat (limited to 'helix-core/src/comment.rs')
-rw-r--r--helix-core/src/comment.rs3
1 files changed, 1 insertions, 2 deletions
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());