From f8a38a122925cd743ed45ecf8c8d516a6f57ed0e Mon Sep 17 00:00:00 2001 From: Nikita Revenco <154856872+NikitaRevenco@users.noreply.github.com> Date: Mon, 10 Feb 2025 05:58:33 +0000 Subject: [PATCH] fix: crash when using block comment if no block comment but yes line comment --- helix-term/src/commands.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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())) + } }, ); }