1use std::ops::Range;
2
3use editor::{char_kind, display_map::DisplaySnapshot, movement, Bias, CharKind, DisplayPoint};
4use gpui::{actions, impl_actions, AppContext, WindowContext};
5use language::Selection;
6use serde::Deserialize;
7use workspace::Workspace;
8
9use crate::{motion::right, normal::normal_object, state::Mode, visual::visual_object, Vim};
10
11#[derive(Copy, Clone, Debug, PartialEq)]
12pub enum Object {
13 Word { ignore_punctuation: bool },
14 Sentence,
15 Quotes,
16 BackQuotes,
17 DoubleQuotes,
18 Parentheses,
19 SquareBrackets,
20 CurlyBrackets,
21 AngleBrackets,
22}
23
24#[derive(Clone, Deserialize, PartialEq)]
25#[serde(rename_all = "camelCase")]
26struct Word {
27 #[serde(default)]
28 ignore_punctuation: bool,
29}
30
31actions!(
32 vim,
33 [
34 Sentence,
35 Quotes,
36 BackQuotes,
37 DoubleQuotes,
38 Parentheses,
39 SquareBrackets,
40 CurlyBrackets,
41 AngleBrackets
42 ]
43);
44impl_actions!(vim, [Word]);
45
46pub fn init(cx: &mut AppContext) {
47 cx.add_action(
48 |_: &mut Workspace, &Word { ignore_punctuation }: &Word, cx: _| {
49 object(Object::Word { ignore_punctuation }, cx)
50 },
51 );
52 cx.add_action(|_: &mut Workspace, _: &Sentence, cx: _| object(Object::Sentence, cx));
53 cx.add_action(|_: &mut Workspace, _: &Quotes, cx: _| object(Object::Quotes, cx));
54 cx.add_action(|_: &mut Workspace, _: &BackQuotes, cx: _| object(Object::BackQuotes, cx));
55 cx.add_action(|_: &mut Workspace, _: &DoubleQuotes, cx: _| object(Object::DoubleQuotes, cx));
56 cx.add_action(|_: &mut Workspace, _: &Parentheses, cx: _| object(Object::Parentheses, cx));
57 cx.add_action(|_: &mut Workspace, _: &SquareBrackets, cx: _| {
58 object(Object::SquareBrackets, cx)
59 });
60 cx.add_action(|_: &mut Workspace, _: &CurlyBrackets, cx: _| object(Object::CurlyBrackets, cx));
61 cx.add_action(|_: &mut Workspace, _: &AngleBrackets, cx: _| object(Object::AngleBrackets, cx));
62}
63
64fn object(object: Object, cx: &mut WindowContext) {
65 match Vim::read(cx).state.mode {
66 Mode::Normal => normal_object(object, cx),
67 Mode::Visual { .. } => visual_object(object, cx),
68 Mode::Insert => {
69 // Shouldn't execute a text object in insert mode. Ignoring
70 }
71 }
72}
73
74impl Object {
75 pub fn range(
76 self,
77 map: &DisplaySnapshot,
78 relative_to: DisplayPoint,
79 around: bool,
80 ) -> Option<Range<DisplayPoint>> {
81 match self {
82 Object::Word { ignore_punctuation } => {
83 if around {
84 around_word(map, relative_to, ignore_punctuation)
85 } else {
86 in_word(map, relative_to, ignore_punctuation)
87 }
88 }
89 Object::Sentence => sentence(map, relative_to, around),
90 Object::Quotes => surrounding_markers(map, relative_to, around, false, '\'', '\''),
91 Object::BackQuotes => surrounding_markers(map, relative_to, around, false, '`', '`'),
92 Object::DoubleQuotes => surrounding_markers(map, relative_to, around, false, '"', '"'),
93 Object::Parentheses => surrounding_markers(map, relative_to, around, true, '(', ')'),
94 Object::SquareBrackets => surrounding_markers(map, relative_to, around, true, '[', ']'),
95 Object::CurlyBrackets => surrounding_markers(map, relative_to, around, true, '{', '}'),
96 Object::AngleBrackets => surrounding_markers(map, relative_to, around, true, '<', '>'),
97 }
98 }
99
100 pub fn expand_selection(
101 self,
102 map: &DisplaySnapshot,
103 selection: &mut Selection<DisplayPoint>,
104 around: bool,
105 ) -> bool {
106 if let Some(range) = self.range(map, selection.head(), around) {
107 selection.start = range.start;
108 selection.end = range.end;
109 true
110 } else {
111 false
112 }
113 }
114}
115
116/// Return a range that surrounds the word relative_to is in
117/// If relative_to is at the start of a word, return the word.
118/// If relative_to is between words, return the space between
119fn in_word(
120 map: &DisplaySnapshot,
121 relative_to: DisplayPoint,
122 ignore_punctuation: bool,
123) -> Option<Range<DisplayPoint>> {
124 // Use motion::right so that we consider the character under the cursor when looking for the start
125 let start = movement::find_preceding_boundary_in_line(
126 map,
127 right(map, relative_to, 1),
128 |left, right| {
129 char_kind(left).coerce_punctuation(ignore_punctuation)
130 != char_kind(right).coerce_punctuation(ignore_punctuation)
131 },
132 );
133 let end = movement::find_boundary_in_line(map, relative_to, |left, right| {
134 char_kind(left).coerce_punctuation(ignore_punctuation)
135 != char_kind(right).coerce_punctuation(ignore_punctuation)
136 });
137
138 Some(start..end)
139}
140
141/// Return a range that surrounds the word and following whitespace
142/// relative_to is in.
143/// If relative_to is at the start of a word, return the word and following whitespace.
144/// If relative_to is between words, return the whitespace back and the following word
145
146/// if in word
147/// delete that word
148/// if there is whitespace following the word, delete that as well
149/// otherwise, delete any preceding whitespace
150/// otherwise
151/// delete whitespace around cursor
152/// delete word following the cursor
153fn around_word(
154 map: &DisplaySnapshot,
155 relative_to: DisplayPoint,
156 ignore_punctuation: bool,
157) -> Option<Range<DisplayPoint>> {
158 let in_word = map
159 .chars_at(relative_to)
160 .next()
161 .map(|(c, _)| char_kind(c) != CharKind::Whitespace)
162 .unwrap_or(false);
163
164 if in_word {
165 around_containing_word(map, relative_to, ignore_punctuation)
166 } else {
167 around_next_word(map, relative_to, ignore_punctuation)
168 }
169}
170
171fn around_containing_word(
172 map: &DisplaySnapshot,
173 relative_to: DisplayPoint,
174 ignore_punctuation: bool,
175) -> Option<Range<DisplayPoint>> {
176 in_word(map, relative_to, ignore_punctuation)
177 .map(|range| expand_to_include_whitespace(map, range, true))
178}
179
180fn around_next_word(
181 map: &DisplaySnapshot,
182 relative_to: DisplayPoint,
183 ignore_punctuation: bool,
184) -> Option<Range<DisplayPoint>> {
185 // Get the start of the word
186 let start = movement::find_preceding_boundary_in_line(
187 map,
188 right(map, relative_to, 1),
189 |left, right| {
190 char_kind(left).coerce_punctuation(ignore_punctuation)
191 != char_kind(right).coerce_punctuation(ignore_punctuation)
192 },
193 );
194
195 let mut word_found = false;
196 let end = movement::find_boundary(map, relative_to, |left, right| {
197 let left_kind = char_kind(left).coerce_punctuation(ignore_punctuation);
198 let right_kind = char_kind(right).coerce_punctuation(ignore_punctuation);
199
200 let found = (word_found && left_kind != right_kind) || right == '\n' && left == '\n';
201
202 if right_kind != CharKind::Whitespace {
203 word_found = true;
204 }
205
206 found
207 });
208
209 Some(start..end)
210}
211
212fn sentence(
213 map: &DisplaySnapshot,
214 relative_to: DisplayPoint,
215 around: bool,
216) -> Option<Range<DisplayPoint>> {
217 let mut start = None;
218 let mut previous_end = relative_to;
219
220 let mut chars = map.chars_at(relative_to).peekable();
221
222 // Search backwards for the previous sentence end or current sentence start. Include the character under relative_to
223 for (char, point) in chars
224 .peek()
225 .cloned()
226 .into_iter()
227 .chain(map.reverse_chars_at(relative_to))
228 {
229 if is_sentence_end(map, point) {
230 break;
231 }
232
233 if is_possible_sentence_start(char) {
234 start = Some(point);
235 }
236
237 previous_end = point;
238 }
239
240 // Search forward for the end of the current sentence or if we are between sentences, the start of the next one
241 let mut end = relative_to;
242 for (char, point) in chars {
243 if start.is_none() && is_possible_sentence_start(char) {
244 if around {
245 start = Some(point);
246 continue;
247 } else {
248 end = point;
249 break;
250 }
251 }
252
253 end = point;
254 *end.column_mut() += char.len_utf8() as u32;
255 end = map.clip_point(end, Bias::Left);
256
257 if is_sentence_end(map, end) {
258 break;
259 }
260 }
261
262 let mut range = start.unwrap_or(previous_end)..end;
263 if around {
264 range = expand_to_include_whitespace(map, range, false);
265 }
266
267 Some(range)
268}
269
270fn is_possible_sentence_start(character: char) -> bool {
271 !character.is_whitespace() && character != '.'
272}
273
274const SENTENCE_END_PUNCTUATION: &[char] = &['.', '!', '?'];
275const SENTENCE_END_FILLERS: &[char] = &[')', ']', '"', '\''];
276const SENTENCE_END_WHITESPACE: &[char] = &[' ', '\t', '\n'];
277fn is_sentence_end(map: &DisplaySnapshot, point: DisplayPoint) -> bool {
278 let mut next_chars = map.chars_at(point).peekable();
279 if let Some((char, _)) = next_chars.next() {
280 // We are at a double newline. This position is a sentence end.
281 if char == '\n' && next_chars.peek().map(|(c, _)| c == &'\n').unwrap_or(false) {
282 return true;
283 }
284
285 // The next text is not a valid whitespace. This is not a sentence end
286 if !SENTENCE_END_WHITESPACE.contains(&char) {
287 return false;
288 }
289 }
290
291 for (char, _) in map.reverse_chars_at(point) {
292 if SENTENCE_END_PUNCTUATION.contains(&char) {
293 return true;
294 }
295
296 if !SENTENCE_END_FILLERS.contains(&char) {
297 return false;
298 }
299 }
300
301 return false;
302}
303
304/// Expands the passed range to include whitespace on one side or the other in a line. Attempts to add the
305/// whitespace to the end first and falls back to the start if there was none.
306fn expand_to_include_whitespace(
307 map: &DisplaySnapshot,
308 mut range: Range<DisplayPoint>,
309 stop_at_newline: bool,
310) -> Range<DisplayPoint> {
311 let mut whitespace_included = false;
312
313 let mut chars = map.chars_at(range.end).peekable();
314 while let Some((char, point)) = chars.next() {
315 if char == '\n' && stop_at_newline {
316 break;
317 }
318
319 if char.is_whitespace() {
320 // Set end to the next display_point or the character position after the current display_point
321 range.end = chars.peek().map(|(_, point)| *point).unwrap_or_else(|| {
322 let mut end = point;
323 *end.column_mut() += char.len_utf8() as u32;
324 map.clip_point(end, Bias::Left)
325 });
326
327 if char != '\n' {
328 whitespace_included = true;
329 }
330 } else {
331 // Found non whitespace. Quit out.
332 break;
333 }
334 }
335
336 if !whitespace_included {
337 for (char, point) in map.reverse_chars_at(range.start) {
338 if char == '\n' && stop_at_newline {
339 break;
340 }
341
342 if !char.is_whitespace() {
343 break;
344 }
345
346 range.start = point;
347 }
348 }
349
350 range
351}
352
353fn surrounding_markers(
354 map: &DisplaySnapshot,
355 relative_to: DisplayPoint,
356 around: bool,
357 search_across_lines: bool,
358 start_marker: char,
359 end_marker: char,
360) -> Option<Range<DisplayPoint>> {
361 let mut matched_ends = 0;
362 let mut start = None;
363 for (char, mut point) in map.reverse_chars_at(relative_to) {
364 if char == start_marker {
365 if matched_ends > 0 {
366 matched_ends -= 1;
367 } else {
368 if around {
369 start = Some(point)
370 } else {
371 *point.column_mut() += char.len_utf8() as u32;
372 start = Some(point);
373 }
374 break;
375 }
376 } else if char == end_marker {
377 matched_ends += 1;
378 } else if char == '\n' && !search_across_lines {
379 break;
380 }
381 }
382
383 let mut matched_starts = 0;
384 let mut end = None;
385 for (char, mut point) in map.chars_at(relative_to) {
386 if char == end_marker {
387 if start.is_none() {
388 break;
389 }
390
391 if matched_starts > 0 {
392 matched_starts -= 1;
393 } else {
394 if around {
395 *point.column_mut() += char.len_utf8() as u32;
396 end = Some(point);
397 } else {
398 end = Some(point);
399 }
400
401 break;
402 }
403 }
404
405 if char == start_marker {
406 if start.is_none() {
407 if around {
408 start = Some(point);
409 } else {
410 *point.column_mut() += char.len_utf8() as u32;
411 start = Some(point);
412 }
413 } else {
414 matched_starts += 1;
415 }
416 }
417
418 if char == '\n' && !search_across_lines {
419 break;
420 }
421 }
422
423 if let (Some(start), Some(end)) = (start, end) {
424 Some(start..end)
425 } else {
426 None
427 }
428}
429
430#[cfg(test)]
431mod test {
432 use indoc::indoc;
433
434 use crate::test::{ExemptionFeatures, NeovimBackedTestContext};
435
436 const WORD_LOCATIONS: &'static str = indoc! {"
437 The quick ˇbrowˇnˇ•••
438 fox ˇjuˇmpsˇ over
439 the lazy dogˇ••
440 ˇ
441 ˇ
442 ˇ
443 Thˇeˇ-ˇquˇickˇ ˇbrownˇ•
444 ˇ••
445 ˇ••
446 ˇ fox-jumpˇs over
447 the lazy dogˇ•
448 ˇ
449 "
450 };
451
452 #[gpui::test]
453 async fn test_change_word_object(cx: &mut gpui::TestAppContext) {
454 let mut cx = NeovimBackedTestContext::new(cx).await;
455
456 cx.assert_binding_matches_all(["c", "i", "w"], WORD_LOCATIONS)
457 .await;
458 cx.assert_binding_matches_all(["c", "i", "shift-w"], WORD_LOCATIONS)
459 .await;
460 cx.assert_binding_matches_all(["c", "a", "w"], WORD_LOCATIONS)
461 .await;
462 cx.assert_binding_matches_all(["c", "a", "shift-w"], WORD_LOCATIONS)
463 .await;
464 }
465
466 #[gpui::test]
467 async fn test_delete_word_object(cx: &mut gpui::TestAppContext) {
468 let mut cx = NeovimBackedTestContext::new(cx).await;
469
470 cx.assert_binding_matches_all(["d", "i", "w"], WORD_LOCATIONS)
471 .await;
472 cx.assert_binding_matches_all(["d", "i", "shift-w"], WORD_LOCATIONS)
473 .await;
474 cx.assert_binding_matches_all(["d", "a", "w"], WORD_LOCATIONS)
475 .await;
476 cx.assert_binding_matches_all(["d", "a", "shift-w"], WORD_LOCATIONS)
477 .await;
478 }
479
480 #[gpui::test]
481 async fn test_visual_word_object(cx: &mut gpui::TestAppContext) {
482 let mut cx = NeovimBackedTestContext::new(cx).await;
483
484 cx.set_shared_state("The quick ˇbrown\nfox").await;
485 cx.simulate_shared_keystrokes(["v"]).await;
486 cx.assert_shared_state("The quick «bˇ»rown\nfox").await;
487 cx.simulate_shared_keystrokes(["i", "w"]).await;
488 cx.assert_shared_state("The quick «brownˇ»\nfox").await;
489
490 cx.assert_binding_matches_all(["v", "i", "w"], WORD_LOCATIONS)
491 .await;
492 cx.assert_binding_matches_all_exempted(
493 ["v", "h", "i", "w"],
494 WORD_LOCATIONS,
495 ExemptionFeatures::NonEmptyVisualTextObjects,
496 )
497 .await;
498 cx.assert_binding_matches_all_exempted(
499 ["v", "l", "i", "w"],
500 WORD_LOCATIONS,
501 ExemptionFeatures::NonEmptyVisualTextObjects,
502 )
503 .await;
504 cx.assert_binding_matches_all(["v", "i", "shift-w"], WORD_LOCATIONS)
505 .await;
506
507 cx.assert_binding_matches_all_exempted(
508 ["v", "i", "h", "shift-w"],
509 WORD_LOCATIONS,
510 ExemptionFeatures::NonEmptyVisualTextObjects,
511 )
512 .await;
513 cx.assert_binding_matches_all_exempted(
514 ["v", "i", "l", "shift-w"],
515 WORD_LOCATIONS,
516 ExemptionFeatures::NonEmptyVisualTextObjects,
517 )
518 .await;
519
520 cx.assert_binding_matches_all_exempted(
521 ["v", "a", "w"],
522 WORD_LOCATIONS,
523 ExemptionFeatures::AroundObjectLeavesWhitespaceAtEndOfLine,
524 )
525 .await;
526 cx.assert_binding_matches_all_exempted(
527 ["v", "a", "shift-w"],
528 WORD_LOCATIONS,
529 ExemptionFeatures::AroundObjectLeavesWhitespaceAtEndOfLine,
530 )
531 .await;
532 }
533
534 const SENTENCE_EXAMPLES: &[&'static str] = &[
535 "ˇThe quick ˇbrownˇ?ˇ ˇFox Jˇumpsˇ!ˇ Ovˇer theˇ lazyˇ.",
536 indoc! {"
537 ˇThe quick ˇbrownˇ
538 fox jumps over
539 the lazy doˇgˇ.ˇ ˇThe quick ˇ
540 brown fox jumps over
541 "},
542 indoc! {"
543 The quick brown fox jumps.
544 Over the lazy dog
545 ˇ
546 ˇ
547 ˇ fox-jumpˇs over
548 the lazy dog.ˇ
549 ˇ
550 "},
551 r#"ˇThe ˇquick brownˇ.)ˇ]ˇ'ˇ" Brown ˇfox jumpsˇ.ˇ "#,
552 ];
553
554 #[gpui::test]
555 async fn test_change_sentence_object(cx: &mut gpui::TestAppContext) {
556 let mut cx = NeovimBackedTestContext::new(cx)
557 .await
558 .binding(["c", "i", "s"]);
559 cx.add_initial_state_exemptions(
560 "The quick brown fox jumps.\nOver the lazy dog\nˇ\nˇ\n fox-jumps over\nthe lazy dog.\n\n",
561 ExemptionFeatures::SentenceOnEmptyLines);
562 cx.add_initial_state_exemptions(
563 "The quick brown fox jumps.\nOver the lazy dog\n\n\nˇ foxˇ-ˇjumpˇs over\nthe lazy dog.\n\n",
564 ExemptionFeatures::SentenceAtStartOfLineWithWhitespace);
565 cx.add_initial_state_exemptions(
566 "The quick brown fox jumps.\nOver the lazy dog\n\n\n fox-jumps over\nthe lazy dog.ˇ\nˇ\n",
567 ExemptionFeatures::SentenceAfterPunctuationAtEndOfFile);
568 for sentence_example in SENTENCE_EXAMPLES {
569 cx.assert_all(sentence_example).await;
570 }
571
572 let mut cx = cx.binding(["c", "a", "s"]);
573 cx.add_initial_state_exemptions(
574 "The quick brown?ˇ Fox Jumps! Over the lazy.",
575 ExemptionFeatures::IncorrectLandingPosition,
576 );
577 cx.add_initial_state_exemptions(
578 "The quick brown.)]\'\" Brown fox jumps.ˇ ",
579 ExemptionFeatures::AroundObjectLeavesWhitespaceAtEndOfLine,
580 );
581
582 for sentence_example in SENTENCE_EXAMPLES {
583 cx.assert_all(sentence_example).await;
584 }
585 }
586
587 #[gpui::test]
588 async fn test_delete_sentence_object(cx: &mut gpui::TestAppContext) {
589 let mut cx = NeovimBackedTestContext::new(cx)
590 .await
591 .binding(["d", "i", "s"]);
592 cx.add_initial_state_exemptions(
593 "The quick brown fox jumps.\nOver the lazy dog\nˇ\nˇ\n fox-jumps over\nthe lazy dog.\n\n",
594 ExemptionFeatures::SentenceOnEmptyLines);
595 cx.add_initial_state_exemptions(
596 "The quick brown fox jumps.\nOver the lazy dog\n\n\nˇ foxˇ-ˇjumpˇs over\nthe lazy dog.\n\n",
597 ExemptionFeatures::SentenceAtStartOfLineWithWhitespace);
598 cx.add_initial_state_exemptions(
599 "The quick brown fox jumps.\nOver the lazy dog\n\n\n fox-jumps over\nthe lazy dog.ˇ\nˇ\n",
600 ExemptionFeatures::SentenceAfterPunctuationAtEndOfFile);
601
602 for sentence_example in SENTENCE_EXAMPLES {
603 cx.assert_all(sentence_example).await;
604 }
605
606 let mut cx = cx.binding(["d", "a", "s"]);
607 cx.add_initial_state_exemptions(
608 "The quick brown?ˇ Fox Jumps! Over the lazy.",
609 ExemptionFeatures::IncorrectLandingPosition,
610 );
611 cx.add_initial_state_exemptions(
612 "The quick brown.)]\'\" Brown fox jumps.ˇ ",
613 ExemptionFeatures::AroundObjectLeavesWhitespaceAtEndOfLine,
614 );
615
616 for sentence_example in SENTENCE_EXAMPLES {
617 cx.assert_all(sentence_example).await;
618 }
619 }
620
621 #[gpui::test]
622 async fn test_visual_sentence_object(cx: &mut gpui::TestAppContext) {
623 let mut cx = NeovimBackedTestContext::new(cx)
624 .await
625 .binding(["v", "i", "s"]);
626 for sentence_example in SENTENCE_EXAMPLES {
627 cx.assert_all_exempted(sentence_example, ExemptionFeatures::SentenceOnEmptyLines)
628 .await;
629 }
630
631 let mut cx = cx.binding(["v", "a", "s"]);
632 for sentence_example in SENTENCE_EXAMPLES {
633 cx.assert_all_exempted(
634 sentence_example,
635 ExemptionFeatures::AroundSentenceStartingBetweenIncludesWrongWhitespace,
636 )
637 .await;
638 }
639 }
640
641 // Test string with "`" for opening surrounders and "'" for closing surrounders
642 const SURROUNDING_MARKER_STRING: &str = indoc! {"
643 ˇTh'ˇe ˇ`ˇ'ˇquˇi`ˇck broˇ'wn`
644 'ˇfox juˇmps ovˇ`ˇer
645 the ˇlazy dˇ'ˇoˇ`ˇg"};
646
647 const SURROUNDING_OBJECTS: &[(char, char)] = &[
648 ('\'', '\''), // Quote
649 ('`', '`'), // Back Quote
650 ('"', '"'), // Double Quote
651 ('(', ')'), // Parentheses
652 ('[', ']'), // SquareBrackets
653 ('{', '}'), // CurlyBrackets
654 ('<', '>'), // AngleBrackets
655 ];
656
657 #[gpui::test]
658 async fn test_change_surrounding_character_objects(cx: &mut gpui::TestAppContext) {
659 let mut cx = NeovimBackedTestContext::new(cx).await;
660
661 for (start, end) in SURROUNDING_OBJECTS {
662 if ((start == &'\'' || start == &'`' || start == &'"')
663 && !ExemptionFeatures::QuotesSeekForward.supported())
664 || (start == &'<' && !ExemptionFeatures::AngleBracketsFreezeNeovim.supported())
665 {
666 continue;
667 }
668
669 let marked_string = SURROUNDING_MARKER_STRING
670 .replace('`', &start.to_string())
671 .replace('\'', &end.to_string());
672
673 cx.assert_binding_matches_all(["c", "i", &start.to_string()], &marked_string)
674 .await;
675 cx.assert_binding_matches_all(["c", "i", &end.to_string()], &marked_string)
676 .await;
677 cx.assert_binding_matches_all(["c", "a", &start.to_string()], &marked_string)
678 .await;
679 cx.assert_binding_matches_all(["c", "a", &end.to_string()], &marked_string)
680 .await;
681 }
682 }
683
684 #[gpui::test]
685 async fn test_delete_surrounding_character_objects(cx: &mut gpui::TestAppContext) {
686 let mut cx = NeovimBackedTestContext::new(cx).await;
687
688 for (start, end) in SURROUNDING_OBJECTS {
689 if ((start == &'\'' || start == &'`' || start == &'"')
690 && !ExemptionFeatures::QuotesSeekForward.supported())
691 || (start == &'<' && !ExemptionFeatures::AngleBracketsFreezeNeovim.supported())
692 {
693 continue;
694 }
695 let marked_string = SURROUNDING_MARKER_STRING
696 .replace('`', &start.to_string())
697 .replace('\'', &end.to_string());
698
699 cx.assert_binding_matches_all(["d", "i", &start.to_string()], &marked_string)
700 .await;
701 cx.assert_binding_matches_all(["d", "i", &end.to_string()], &marked_string)
702 .await;
703 cx.assert_binding_matches_all(["d", "a", &start.to_string()], &marked_string)
704 .await;
705 cx.assert_binding_matches_all(["d", "a", &end.to_string()], &marked_string)
706 .await;
707 }
708 }
709}