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