1use super::{Bias, DisplayPoint, DisplaySnapshot, SelectionGoal, ToDisplayPoint};
2use crate::{char_kind, CharKind, ToPoint};
3use language::Point;
4use std::ops::Range;
5
6pub fn left(map: &DisplaySnapshot, mut point: DisplayPoint) -> DisplayPoint {
7 if point.column() > 0 {
8 *point.column_mut() -= 1;
9 } else if point.row() > 0 {
10 *point.row_mut() -= 1;
11 *point.column_mut() = map.line_len(point.row());
12 }
13 map.clip_point(point, Bias::Left)
14}
15
16pub fn right(map: &DisplaySnapshot, mut point: DisplayPoint) -> DisplayPoint {
17 let max_column = map.line_len(point.row());
18 if point.column() < max_column {
19 *point.column_mut() += 1;
20 } else if point.row() < map.max_point().row() {
21 *point.row_mut() += 1;
22 *point.column_mut() = 0;
23 }
24 map.clip_point(point, Bias::Right)
25}
26
27pub fn up(
28 map: &DisplaySnapshot,
29 start: DisplayPoint,
30 goal: SelectionGoal,
31 preserve_column_at_start: bool,
32) -> (DisplayPoint, SelectionGoal) {
33 up_by_rows(map, start, 1, goal, preserve_column_at_start)
34}
35
36pub fn down(
37 map: &DisplaySnapshot,
38 start: DisplayPoint,
39 goal: SelectionGoal,
40 preserve_column_at_end: bool,
41) -> (DisplayPoint, SelectionGoal) {
42 down_by_rows(map, start, 1, goal, preserve_column_at_end)
43}
44
45pub fn up_by_rows(
46 map: &DisplaySnapshot,
47 start: DisplayPoint,
48 row_count: u32,
49 goal: SelectionGoal,
50 preserve_column_at_start: bool,
51) -> (DisplayPoint, SelectionGoal) {
52 let mut goal_column = if let SelectionGoal::Column(column) = goal {
53 column
54 } else {
55 map.column_to_chars(start.row(), start.column())
56 };
57
58 let prev_row = start.row().saturating_sub(row_count);
59 let mut point = map.clip_point(
60 DisplayPoint::new(prev_row, map.line_len(prev_row)),
61 Bias::Left,
62 );
63 if point.row() < start.row() {
64 *point.column_mut() = map.column_from_chars(point.row(), goal_column);
65 } else if preserve_column_at_start {
66 return (start, goal);
67 } else {
68 point = DisplayPoint::new(0, 0);
69 goal_column = 0;
70 }
71
72 let clip_bias = if point.column() == map.line_len(point.row()) {
73 Bias::Left
74 } else {
75 Bias::Right
76 };
77
78 (
79 map.clip_point(point, clip_bias),
80 SelectionGoal::Column(goal_column),
81 )
82}
83
84pub fn down_by_rows(
85 map: &DisplaySnapshot,
86 start: DisplayPoint,
87 row_count: u32,
88 goal: SelectionGoal,
89 preserve_column_at_end: bool,
90) -> (DisplayPoint, SelectionGoal) {
91 let mut goal_column = if let SelectionGoal::Column(column) = goal {
92 column
93 } else {
94 map.column_to_chars(start.row(), start.column())
95 };
96
97 let new_row = start.row() + row_count;
98 let mut point = map.clip_point(DisplayPoint::new(new_row, 0), Bias::Right);
99 if point.row() > start.row() {
100 *point.column_mut() = map.column_from_chars(point.row(), goal_column);
101 } else if preserve_column_at_end {
102 return (start, goal);
103 } else {
104 point = map.max_point();
105 goal_column = map.column_to_chars(point.row(), point.column())
106 }
107
108 let clip_bias = if point.column() == map.line_len(point.row()) {
109 Bias::Left
110 } else {
111 Bias::Right
112 };
113
114 (
115 map.clip_point(point, clip_bias),
116 SelectionGoal::Column(goal_column),
117 )
118}
119
120pub fn line_beginning(
121 map: &DisplaySnapshot,
122 display_point: DisplayPoint,
123 stop_at_soft_boundaries: bool,
124) -> DisplayPoint {
125 let point = display_point.to_point(map);
126 let soft_line_start = map.clip_point(DisplayPoint::new(display_point.row(), 0), Bias::Right);
127 let line_start = map.prev_line_boundary(point).1;
128
129 if stop_at_soft_boundaries && display_point != soft_line_start {
130 soft_line_start
131 } else {
132 line_start
133 }
134}
135
136pub fn indented_line_beginning(
137 map: &DisplaySnapshot,
138 display_point: DisplayPoint,
139 stop_at_soft_boundaries: bool,
140) -> DisplayPoint {
141 let point = display_point.to_point(map);
142 let soft_line_start = map.clip_point(DisplayPoint::new(display_point.row(), 0), Bias::Right);
143 let indent_start = Point::new(
144 point.row,
145 map.buffer_snapshot.indent_size_for_line(point.row).len,
146 )
147 .to_display_point(map);
148 let line_start = map.prev_line_boundary(point).1;
149
150 if stop_at_soft_boundaries && soft_line_start > indent_start && display_point != soft_line_start
151 {
152 soft_line_start
153 } else if stop_at_soft_boundaries && display_point != indent_start {
154 indent_start
155 } else {
156 line_start
157 }
158}
159
160pub fn line_end(
161 map: &DisplaySnapshot,
162 display_point: DisplayPoint,
163 stop_at_soft_boundaries: bool,
164) -> DisplayPoint {
165 let soft_line_end = map.clip_point(
166 DisplayPoint::new(display_point.row(), map.line_len(display_point.row())),
167 Bias::Left,
168 );
169 if stop_at_soft_boundaries && display_point != soft_line_end {
170 soft_line_end
171 } else {
172 map.next_line_boundary(display_point.to_point(map)).1
173 }
174}
175
176pub fn previous_word_start(map: &DisplaySnapshot, point: DisplayPoint) -> DisplayPoint {
177 find_preceding_boundary(map, point, |left, right| {
178 (char_kind(left) != char_kind(right) && !right.is_whitespace()) || left == '\n'
179 })
180}
181
182pub fn previous_subword_start(map: &DisplaySnapshot, point: DisplayPoint) -> DisplayPoint {
183 find_preceding_boundary(map, point, |left, right| {
184 let is_word_start = char_kind(left) != char_kind(right) && !right.is_whitespace();
185 let is_subword_start =
186 left == '_' && right != '_' || left.is_lowercase() && right.is_uppercase();
187 is_word_start || is_subword_start || left == '\n'
188 })
189}
190
191pub fn next_word_end(map: &DisplaySnapshot, point: DisplayPoint) -> DisplayPoint {
192 find_boundary(map, point, |left, right| {
193 (char_kind(left) != char_kind(right) && !left.is_whitespace()) || right == '\n'
194 })
195}
196
197pub fn next_subword_end(map: &DisplaySnapshot, point: DisplayPoint) -> DisplayPoint {
198 find_boundary(map, point, |left, right| {
199 let is_word_end = (char_kind(left) != char_kind(right)) && !left.is_whitespace();
200 let is_subword_end =
201 left != '_' && right == '_' || left.is_lowercase() && right.is_uppercase();
202 is_word_end || is_subword_end || right == '\n'
203 })
204}
205
206/// Scans for a boundary preceding the given start point `from` until a boundary is found, indicated by the
207/// given predicate returning true. The predicate is called with the character to the left and right
208/// of the candidate boundary location, and will be called with `\n` characters indicating the start
209/// or end of a line.
210pub fn find_preceding_boundary(
211 map: &DisplaySnapshot,
212 from: DisplayPoint,
213 mut is_boundary: impl FnMut(char, char) -> bool,
214) -> DisplayPoint {
215 let mut start_column = 0;
216 let mut soft_wrap_row = from.row() + 1;
217
218 let mut prev = None;
219 for (ch, point) in map.reverse_chars_at(from) {
220 // Recompute soft_wrap_indent if the row has changed
221 if point.row() != soft_wrap_row {
222 soft_wrap_row = point.row();
223
224 if point.row() == 0 {
225 start_column = 0;
226 } else if let Some(indent) = map.soft_wrap_indent(point.row() - 1) {
227 start_column = indent;
228 }
229 }
230
231 // If the current point is in the soft_wrap, skip comparing it
232 if point.column() < start_column {
233 continue;
234 }
235
236 if let Some((prev_ch, prev_point)) = prev {
237 if is_boundary(ch, prev_ch) {
238 return prev_point;
239 }
240 }
241
242 prev = Some((ch, point));
243 }
244 DisplayPoint::zero()
245}
246
247/// Scans for a boundary preceding the given start point `from` until a boundary is found, indicated by the
248/// given predicate returning true. The predicate is called with the character to the left and right
249/// of the candidate boundary location, and will be called with `\n` characters indicating the start
250/// or end of a line. If no boundary is found, the start of the line is returned.
251pub fn find_preceding_boundary_in_line(
252 map: &DisplaySnapshot,
253 from: DisplayPoint,
254 mut is_boundary: impl FnMut(char, char) -> bool,
255) -> DisplayPoint {
256 let mut start_column = 0;
257 if from.row() > 0 {
258 if let Some(indent) = map.soft_wrap_indent(from.row() - 1) {
259 start_column = indent;
260 }
261 }
262
263 let mut prev = None;
264 for (ch, point) in map.reverse_chars_at(from) {
265 if let Some((prev_ch, prev_point)) = prev {
266 if is_boundary(ch, prev_ch) {
267 return prev_point;
268 }
269 }
270
271 if ch == '\n' || point.column() < start_column {
272 break;
273 }
274
275 prev = Some((ch, point));
276 }
277
278 prev.map(|(_, point)| point).unwrap_or(from)
279}
280
281/// Scans for a boundary following the given start point until a boundary is found, indicated by the
282/// given predicate returning true. The predicate is called with the character to the left and right
283/// of the candidate boundary location, and will be called with `\n` characters indicating the start
284/// or end of a line.
285pub fn find_boundary(
286 map: &DisplaySnapshot,
287 from: DisplayPoint,
288 mut is_boundary: impl FnMut(char, char) -> bool,
289) -> DisplayPoint {
290 let mut prev_ch = None;
291 for (ch, point) in map.chars_at(from) {
292 if let Some(prev_ch) = prev_ch {
293 if is_boundary(prev_ch, ch) {
294 return map.clip_point(point, Bias::Right);
295 }
296 }
297
298 prev_ch = Some(ch);
299 }
300 map.clip_point(map.max_point(), Bias::Right)
301}
302
303/// Scans for a boundary following the given start point until a boundary is found, indicated by the
304/// given predicate returning true. The predicate is called with the character to the left and right
305/// of the candidate boundary location, and will be called with `\n` characters indicating the start
306/// or end of a line. If no boundary is found, the end of the line is returned
307pub fn find_boundary_in_line(
308 map: &DisplaySnapshot,
309 from: DisplayPoint,
310 mut is_boundary: impl FnMut(char, char) -> bool,
311) -> DisplayPoint {
312 let mut prev = None;
313 for (ch, point) in map.chars_at(from) {
314 if let Some((prev_ch, _)) = prev {
315 if is_boundary(prev_ch, ch) {
316 return map.clip_point(point, Bias::Right);
317 }
318 }
319
320 prev = Some((ch, point));
321
322 if ch == '\n' {
323 break;
324 }
325 }
326
327 // Return the last position checked so that we give a point right before the newline or eof.
328 map.clip_point(prev.map(|(_, point)| point).unwrap_or(from), Bias::Right)
329}
330
331pub fn is_inside_word(map: &DisplaySnapshot, point: DisplayPoint) -> bool {
332 let ix = map.clip_point(point, Bias::Left).to_offset(map, Bias::Left);
333 let text = &map.buffer_snapshot;
334 let next_char_kind = text.chars_at(ix).next().map(char_kind);
335 let prev_char_kind = text.reversed_chars_at(ix).next().map(char_kind);
336 prev_char_kind.zip(next_char_kind) == Some((CharKind::Word, CharKind::Word))
337}
338
339pub fn surrounding_word(map: &DisplaySnapshot, position: DisplayPoint) -> Range<DisplayPoint> {
340 let position = map
341 .clip_point(position, Bias::Left)
342 .to_offset(map, Bias::Left);
343 let (range, _) = map.buffer_snapshot.surrounding_word(position);
344 let start = range
345 .start
346 .to_point(&map.buffer_snapshot)
347 .to_display_point(map);
348 let end = range
349 .end
350 .to_point(&map.buffer_snapshot)
351 .to_display_point(map);
352 start..end
353}
354
355pub fn split_display_range_by_lines(
356 map: &DisplaySnapshot,
357 range: Range<DisplayPoint>,
358) -> Vec<Range<DisplayPoint>> {
359 let mut result = Vec::new();
360
361 let mut start = range.start;
362 // Loop over all the covered rows until the one containing the range end
363 for row in range.start.row()..range.end.row() {
364 let row_end_column = map.line_len(row);
365 let end = map.clip_point(DisplayPoint::new(row, row_end_column), Bias::Left);
366 if start != end {
367 result.push(start..end);
368 }
369 start = map.clip_point(DisplayPoint::new(row + 1, 0), Bias::Left);
370 }
371
372 // Add the final range from the start of the last end to the original range end.
373 result.push(start..range.end);
374
375 result
376}
377
378#[cfg(test)]
379mod tests {
380 use super::*;
381 use crate::{test::marked_display_snapshot, Buffer, DisplayMap, ExcerptRange, MultiBuffer};
382 use settings::Settings;
383
384 #[gpui::test]
385 fn test_previous_word_start(cx: &mut gpui::MutableAppContext) {
386 cx.set_global(Settings::test(cx));
387 fn assert(marked_text: &str, cx: &mut gpui::MutableAppContext) {
388 let (snapshot, display_points) = marked_display_snapshot(marked_text, cx);
389 assert_eq!(
390 previous_word_start(&snapshot, display_points[1]),
391 display_points[0]
392 );
393 }
394
395 assert("\nˇ ˇlorem", cx);
396 assert("ˇ\nˇ lorem", cx);
397 assert(" ˇloremˇ", cx);
398 assert("ˇ ˇlorem", cx);
399 assert(" ˇlorˇem", cx);
400 assert("\nlorem\nˇ ˇipsum", cx);
401 assert("\n\nˇ\nˇ", cx);
402 assert(" ˇlorem ˇipsum", cx);
403 assert("loremˇ-ˇipsum", cx);
404 assert("loremˇ-#$@ˇipsum", cx);
405 assert("ˇlorem_ˇipsum", cx);
406 assert(" ˇdefγˇ", cx);
407 assert(" ˇbcΔˇ", cx);
408 assert(" abˇ——ˇcd", cx);
409 }
410
411 #[gpui::test]
412 fn test_previous_subword_start(cx: &mut gpui::MutableAppContext) {
413 cx.set_global(Settings::test(cx));
414 fn assert(marked_text: &str, cx: &mut gpui::MutableAppContext) {
415 let (snapshot, display_points) = marked_display_snapshot(marked_text, cx);
416 assert_eq!(
417 previous_subword_start(&snapshot, display_points[1]),
418 display_points[0]
419 );
420 }
421
422 // Subword boundaries are respected
423 assert("lorem_ˇipˇsum", cx);
424 assert("lorem_ˇipsumˇ", cx);
425 assert("ˇlorem_ˇipsum", cx);
426 assert("lorem_ˇipsum_ˇdolor", cx);
427 assert("loremˇIpˇsum", cx);
428 assert("loremˇIpsumˇ", cx);
429
430 // Word boundaries are still respected
431 assert("\nˇ ˇlorem", cx);
432 assert(" ˇloremˇ", cx);
433 assert(" ˇlorˇem", cx);
434 assert("\nlorem\nˇ ˇipsum", cx);
435 assert("\n\nˇ\nˇ", cx);
436 assert(" ˇlorem ˇipsum", cx);
437 assert("loremˇ-ˇipsum", cx);
438 assert("loremˇ-#$@ˇipsum", cx);
439 assert(" ˇdefγˇ", cx);
440 assert(" bcˇΔˇ", cx);
441 assert(" ˇbcδˇ", cx);
442 assert(" abˇ——ˇcd", cx);
443 }
444
445 #[gpui::test]
446 fn test_find_preceding_boundary(cx: &mut gpui::MutableAppContext) {
447 cx.set_global(Settings::test(cx));
448 fn assert(
449 marked_text: &str,
450 cx: &mut gpui::MutableAppContext,
451 is_boundary: impl FnMut(char, char) -> bool,
452 ) {
453 let (snapshot, display_points) = marked_display_snapshot(marked_text, cx);
454 assert_eq!(
455 find_preceding_boundary(&snapshot, display_points[1], is_boundary),
456 display_points[0]
457 );
458 }
459
460 assert("abcˇdef\ngh\nijˇk", cx, |left, right| {
461 left == 'c' && right == 'd'
462 });
463 assert("abcdef\nˇgh\nijˇk", cx, |left, right| {
464 left == '\n' && right == 'g'
465 });
466 let mut line_count = 0;
467 assert("abcdef\nˇgh\nijˇk", cx, |left, _| {
468 if left == '\n' {
469 line_count += 1;
470 line_count == 2
471 } else {
472 false
473 }
474 });
475 }
476
477 #[gpui::test]
478 fn test_next_word_end(cx: &mut gpui::MutableAppContext) {
479 cx.set_global(Settings::test(cx));
480 fn assert(marked_text: &str, cx: &mut gpui::MutableAppContext) {
481 let (snapshot, display_points) = marked_display_snapshot(marked_text, cx);
482 assert_eq!(
483 next_word_end(&snapshot, display_points[0]),
484 display_points[1]
485 );
486 }
487
488 assert("\nˇ loremˇ", cx);
489 assert(" ˇloremˇ", cx);
490 assert(" lorˇemˇ", cx);
491 assert(" loremˇ ˇ\nipsum\n", cx);
492 assert("\nˇ\nˇ\n\n", cx);
493 assert("loremˇ ipsumˇ ", cx);
494 assert("loremˇ-ˇipsum", cx);
495 assert("loremˇ#$@-ˇipsum", cx);
496 assert("loremˇ_ipsumˇ", cx);
497 assert(" ˇbcΔˇ", cx);
498 assert(" abˇ——ˇcd", cx);
499 }
500
501 #[gpui::test]
502 fn test_next_subword_end(cx: &mut gpui::MutableAppContext) {
503 cx.set_global(Settings::test(cx));
504 fn assert(marked_text: &str, cx: &mut gpui::MutableAppContext) {
505 let (snapshot, display_points) = marked_display_snapshot(marked_text, cx);
506 assert_eq!(
507 next_subword_end(&snapshot, display_points[0]),
508 display_points[1]
509 );
510 }
511
512 // Subword boundaries are respected
513 assert("loˇremˇ_ipsum", cx);
514 assert("ˇloremˇ_ipsum", cx);
515 assert("loremˇ_ipsumˇ", cx);
516 assert("loremˇ_ipsumˇ_dolor", cx);
517 assert("loˇremˇIpsum", cx);
518 assert("loremˇIpsumˇDolor", cx);
519
520 // Word boundaries are still respected
521 assert("\nˇ loremˇ", cx);
522 assert(" ˇloremˇ", cx);
523 assert(" lorˇemˇ", cx);
524 assert(" loremˇ ˇ\nipsum\n", cx);
525 assert("\nˇ\nˇ\n\n", cx);
526 assert("loremˇ ipsumˇ ", cx);
527 assert("loremˇ-ˇipsum", cx);
528 assert("loremˇ#$@-ˇipsum", cx);
529 assert("loremˇ_ipsumˇ", cx);
530 assert(" ˇbcˇΔ", cx);
531 assert(" abˇ——ˇcd", cx);
532 }
533
534 #[gpui::test]
535 fn test_find_boundary(cx: &mut gpui::MutableAppContext) {
536 cx.set_global(Settings::test(cx));
537 fn assert(
538 marked_text: &str,
539 cx: &mut gpui::MutableAppContext,
540 is_boundary: impl FnMut(char, char) -> bool,
541 ) {
542 let (snapshot, display_points) = marked_display_snapshot(marked_text, cx);
543 assert_eq!(
544 find_boundary(&snapshot, display_points[0], is_boundary),
545 display_points[1]
546 );
547 }
548
549 assert("abcˇdef\ngh\nijˇk", cx, |left, right| {
550 left == 'j' && right == 'k'
551 });
552 assert("abˇcdef\ngh\nˇijk", cx, |left, right| {
553 left == '\n' && right == 'i'
554 });
555 let mut line_count = 0;
556 assert("abcˇdef\ngh\nˇijk", cx, |left, _| {
557 if left == '\n' {
558 line_count += 1;
559 line_count == 2
560 } else {
561 false
562 }
563 });
564 }
565
566 #[gpui::test]
567 fn test_surrounding_word(cx: &mut gpui::MutableAppContext) {
568 cx.set_global(Settings::test(cx));
569 fn assert(marked_text: &str, cx: &mut gpui::MutableAppContext) {
570 let (snapshot, display_points) = marked_display_snapshot(marked_text, cx);
571 assert_eq!(
572 surrounding_word(&snapshot, display_points[1]),
573 display_points[0]..display_points[2]
574 );
575 }
576
577 assert("ˇˇloremˇ ipsum", cx);
578 assert("ˇloˇremˇ ipsum", cx);
579 assert("ˇloremˇˇ ipsum", cx);
580 assert("loremˇ ˇ ˇipsum", cx);
581 assert("lorem\nˇˇˇ\nipsum", cx);
582 assert("lorem\nˇˇipsumˇ", cx);
583 assert("lorem,ˇˇ ˇipsum", cx);
584 assert("ˇloremˇˇ, ipsum", cx);
585 }
586
587 #[gpui::test]
588 fn test_move_up_and_down_with_excerpts(cx: &mut gpui::MutableAppContext) {
589 cx.set_global(Settings::test(cx));
590 let family_id = cx.font_cache().load_family(&["Helvetica"]).unwrap();
591 let font_id = cx
592 .font_cache()
593 .select_font(family_id, &Default::default())
594 .unwrap();
595
596 let buffer = cx.add_model(|cx| Buffer::new(0, "abc\ndefg\nhijkl\nmn", cx));
597 let multibuffer = cx.add_model(|cx| {
598 let mut multibuffer = MultiBuffer::new(0);
599 multibuffer.push_excerpts(
600 buffer.clone(),
601 [
602 ExcerptRange {
603 context: Point::new(0, 0)..Point::new(1, 4),
604 primary: None,
605 },
606 ExcerptRange {
607 context: Point::new(2, 0)..Point::new(3, 2),
608 primary: None,
609 },
610 ],
611 cx,
612 );
613 multibuffer
614 });
615 let display_map =
616 cx.add_model(|cx| DisplayMap::new(multibuffer, font_id, 14.0, None, 2, 2, cx));
617 let snapshot = display_map.update(cx, |map, cx| map.snapshot(cx));
618
619 assert_eq!(snapshot.text(), "\n\nabc\ndefg\n\n\nhijkl\nmn");
620
621 // Can't move up into the first excerpt's header
622 assert_eq!(
623 up(
624 &snapshot,
625 DisplayPoint::new(2, 2),
626 SelectionGoal::Column(2),
627 false
628 ),
629 (DisplayPoint::new(2, 0), SelectionGoal::Column(0)),
630 );
631 assert_eq!(
632 up(
633 &snapshot,
634 DisplayPoint::new(2, 0),
635 SelectionGoal::None,
636 false
637 ),
638 (DisplayPoint::new(2, 0), SelectionGoal::Column(0)),
639 );
640
641 // Move up and down within first excerpt
642 assert_eq!(
643 up(
644 &snapshot,
645 DisplayPoint::new(3, 4),
646 SelectionGoal::Column(4),
647 false
648 ),
649 (DisplayPoint::new(2, 3), SelectionGoal::Column(4)),
650 );
651 assert_eq!(
652 down(
653 &snapshot,
654 DisplayPoint::new(2, 3),
655 SelectionGoal::Column(4),
656 false
657 ),
658 (DisplayPoint::new(3, 4), SelectionGoal::Column(4)),
659 );
660
661 // Move up and down across second excerpt's header
662 assert_eq!(
663 up(
664 &snapshot,
665 DisplayPoint::new(6, 5),
666 SelectionGoal::Column(5),
667 false
668 ),
669 (DisplayPoint::new(3, 4), SelectionGoal::Column(5)),
670 );
671 assert_eq!(
672 down(
673 &snapshot,
674 DisplayPoint::new(3, 4),
675 SelectionGoal::Column(5),
676 false
677 ),
678 (DisplayPoint::new(6, 5), SelectionGoal::Column(5)),
679 );
680
681 // Can't move down off the end
682 assert_eq!(
683 down(
684 &snapshot,
685 DisplayPoint::new(7, 0),
686 SelectionGoal::Column(0),
687 false
688 ),
689 (DisplayPoint::new(7, 2), SelectionGoal::Column(2)),
690 );
691 assert_eq!(
692 down(
693 &snapshot,
694 DisplayPoint::new(7, 2),
695 SelectionGoal::Column(2),
696 false
697 ),
698 (DisplayPoint::new(7, 2), SelectionGoal::Column(2)),
699 );
700 }
701}