From 7d53290dd23d4f7c0323bcb38b16a43370bc73dc Mon Sep 17 00:00:00 2001 From: Nikita Revenco <154856872+NikitaRevenco@users.noreply.github.com> Date: Mon, 3 Feb 2025 12:46:12 +0000 Subject: [PATCH] fix: panic --- 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 13eb0307b..e12c80b65 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -5244,7 +5244,11 @@ fn toggle_line_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())) + } }, ); }