@@ -171,9 +171,10 @@ private static void ProcessMultiPointSelection(MarkupElementSyntax startElementN
171
171
var startNodeContainsEndNode = endElementNode . Ancestors ( ) . Any ( node => node == startElementNode ) ;
172
172
173
173
// If the start element is an ancestor, keep the original end; otherwise, use the end of the end element
174
- if ( ! startNodeContainsEndNode )
174
+ if ( startNodeContainsEndNode )
175
175
{
176
- actionParams . ExtractEnd = endElementNode . Span . End ;
176
+ actionParams . ExtractEnd = startElementNode . Span . End ;
177
+ return ;
177
178
}
178
179
179
180
// If the start element is not an ancestor of the end element, we need to find a common parent
@@ -189,19 +190,17 @@ private static void ProcessMultiPointSelection(MarkupElementSyntax startElementN
189
190
// Selected text ends here <span></span>
190
191
// </div>
191
192
// In this case, we need to find the smallest set of complete elements that covers the entire selection.
192
- if ( ! startNodeContainsEndNode )
193
- {
194
- // Find the closest containing sibling pair that encompasses both the start and end elements
195
- var ( extractStart , extractEnd ) = FindContainingSiblingPair ( startElementNode , endElementNode ) ;
193
+
194
+ // Find the closest containing sibling pair that encompasses both the start and end elements
195
+ var ( extractStart , extractEnd ) = FindContainingSiblingPair ( startElementNode , endElementNode ) ;
196
196
197
- // If we found a valid containing pair, update the extraction range
198
- if ( extractStart is not null && extractEnd is not null )
199
- {
200
- actionParams . ExtractStart = extractStart . Span . Start ;
201
- actionParams . ExtractEnd = extractEnd . Span . End ;
202
- }
203
- // Note: If we don't find a valid pair, we keep the original extraction range
197
+ // If we found a valid containing pair, update the extraction range
198
+ if ( extractStart is not null && extractEnd is not null )
199
+ {
200
+ actionParams . ExtractStart = extractStart . Span . Start ;
201
+ actionParams . ExtractEnd = extractEnd . Span . End ;
204
202
}
203
+ // Note: If we don't find a valid pair, we keep the original extraction range
205
204
}
206
205
207
206
private static bool IsMultiPointSelection ( Range range ) => range . Start != range . End ;
0 commit comments