|
|
@ -5865,6 +5865,24 @@ fn surround_delete(cx: &mut Context) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
let mut ranges: SmallVec<[Range; 1]> = change_pos
|
|
|
|
|
|
|
|
.iter()
|
|
|
|
|
|
|
|
.flat_map(|&((opening_tag_range, closing_tag_range), _)| {
|
|
|
|
|
|
|
|
vec![opening_tag_range, closing_tag_range]
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.collect();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ranges.sort_by(|a, b| a.from().cmp(&b.from()));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let has_overlaps = ranges
|
|
|
|
|
|
|
|
.windows(2)
|
|
|
|
|
|
|
|
.any(|window| window[0].to() > window[1].from());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if has_overlaps {
|
|
|
|
|
|
|
|
cx.editor
|
|
|
|
|
|
|
|
.set_error("Cursors overlap for a single surround pair range");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
let transaction = Transaction::change(
|
|
|
|
let transaction = Transaction::change(
|
|
|
|
doc.text(),
|
|
|
|
doc.text(),
|
|
|
|
change_pos.iter().flat_map(|(pos, _)| {
|
|
|
|
change_pos.iter().flat_map(|(pos, _)| {
|
|
|
|