From 2644e2e6854b19fbe8bcb8cf430085cf0deaf7d7 Mon Sep 17 00:00:00 2001 From: WMJ Date: Thu, 5 Dec 2024 15:31:05 +0800 Subject: [PATCH] ! Tweak AddEditAllMatchingCommand --- Codist/SmartBars/SmartBar.CommonEdit.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Codist/SmartBars/SmartBar.CommonEdit.cs b/Codist/SmartBars/SmartBar.CommonEdit.cs index 6e9c59fb..cb18a441 100644 --- a/Codist/SmartBars/SmartBar.CommonEdit.cs +++ b/Codist/SmartBars/SmartBar.CommonEdit.cs @@ -195,15 +195,14 @@ protected void AddCommentCommand(System.Windows.Controls.ToolBar toolBar) { void AddEditAllMatchingCommand() { AddCommand(ToolBar, IconIds.EditMatches, R.CMD_EditMatches, ctx => { - var spans = ctx.View.Selection.SelectedSpans; - if (spans.Count < 1) { + var b = ctx.View.GetMultiSelectionBroker(); + if (b.HasMultipleSelections || b.PrimarySelection.IsEmpty) { return; } - var s = spans[0]; + var s = b.PrimarySelection.Extent.SnapshotSpan; if (s.Length == 0) { return; } - var b = ctx.View.GetMultiSelectionBroker(); var option = FindOptions.Wrap | FindOptions.OrdinalComparison; var m = ctx.ModifierKeys; if (m.MatchFlags(ModifierKeys.Control)) {