diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 753a42743..0ae097749 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -5295,7 +5295,11 @@ fn toggle_block_comments(cx: &mut Context) { }), ); - transaction.with_selection(Selection::new(selections, selection.primary_index())) + if selections.is_empty() { + transaction + } else { + transaction.with_selection(Selection::new(selections, selection.primary_index())) + } }, ); }