From 5b4c0d64bcc36c8e31476ae3500f7e9769ee5342 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 9 Feb 2022 13:51:52 -0800 Subject: [PATCH] Get tests passing and project diagnostics view working w/ new excerpt headers --- crates/diagnostics/src/diagnostics.rs | 59 +++++++--------- crates/editor/src/display_map.rs | 20 +++--- crates/editor/src/display_map/block_map.rs | 31 +++++++-- crates/editor/src/editor.rs | 71 ++++++++++--------- crates/editor/src/element.rs | 81 +++++++++++++--------- crates/editor/src/movement.rs | 24 +++---- 6 files changed, 162 insertions(+), 124 deletions(-) diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rs index 6a7f135a6253244e53d0e1909b0526f22b7bd215..3438cddd6dd7c506c129e2c043c1209f2dcb4dd4 100644 --- a/crates/diagnostics/src/diagnostics.rs +++ b/crates/diagnostics/src/diagnostics.rs @@ -68,7 +68,6 @@ struct ProjectDiagnosticsEditor { struct PathState { path: ProjectPath, - header: Option, diagnostic_groups: Vec, } @@ -258,7 +257,6 @@ impl ProjectDiagnosticsEditor { ix, PathState { path: path.clone(), - header: None, diagnostic_groups: Default::default(), }, ); @@ -365,14 +363,6 @@ impl ProjectDiagnosticsEditor { ), disposition: BlockDisposition::Above, }); - } else { - group_state.block_count += 1; - blocks_to_add.push(BlockProperties { - position: header_position, - height: 1, - render: context_header_renderer(self.build_settings.clone()), - disposition: BlockDisposition::Above, - }); } for entry in &group.entries[*start_ix..ix] { @@ -421,7 +411,6 @@ impl ProjectDiagnosticsEditor { }); self.editor.update(cx, |editor, cx| { - blocks_to_remove.extend(path_state.header); editor.remove_blocks(blocks_to_remove, cx); let block_ids = editor.insert_blocks( blocks_to_add.into_iter().map(|block| { @@ -440,7 +429,6 @@ impl ProjectDiagnosticsEditor { for group_state in &mut groups_to_add { group_state.blocks = block_ids.by_ref().take(group_state.block_count).collect(); } - path_state.header = block_ids.next(); }); for ix in group_ixs_to_remove.into_iter().rev() { @@ -704,17 +692,6 @@ fn diagnostic_header_renderer( }) } -fn context_header_renderer(build_settings: BuildSettings) -> RenderBlock { - Arc::new(move |cx| { - let settings = build_settings(cx); - let text_style = settings.style.text.clone(); - Label::new("…".to_string(), text_style) - .contained() - .with_padding_left(cx.gutter_padding + cx.scroll_x * cx.em_width) - .named("collapsed context") - }) -} - pub(crate) fn render_summary( summary: &DiagnosticSummary, text_style: &TextStyle, @@ -939,8 +916,9 @@ mod tests { [ (0, "path header block".into()), (2, "diagnostic header".into()), - (15, "diagnostic header".into()), - (24, "collapsed context".into()), + (15, "collapsed context".into()), + (16, "diagnostic header".into()), + (25, "collapsed context".into()), ] ); assert_eq!( @@ -965,6 +943,7 @@ mod tests { " c(y);\n", "\n", // supporting diagnostic " d(x);\n", + "\n", // context ellipsis // diagnostic group 2 "\n", // primary message "\n", // padding @@ -1027,8 +1006,9 @@ mod tests { (2, "diagnostic header".into()), (7, "path header block".into()), (9, "diagnostic header".into()), - (22, "diagnostic header".into()), - (31, "collapsed context".into()), + (22, "collapsed context".into()), + (23, "diagnostic header".into()), + (32, "collapsed context".into()), ] ); assert_eq!( @@ -1064,6 +1044,7 @@ mod tests { " c(y);\n", "\n", // supporting diagnostic " d(x);\n", + "\n", // collapsed context // diagnostic group 2 "\n", // primary message "\n", // filename @@ -1138,11 +1119,13 @@ mod tests { [ (0, "path header block".into()), (2, "diagnostic header".into()), - (7, "diagnostic header".into()), - (12, "path header block".into()), - (14, "diagnostic header".into()), - (27, "diagnostic header".into()), - (36, "collapsed context".into()), + (7, "collapsed context".into()), + (8, "diagnostic header".into()), + (13, "path header block".into()), + (15, "diagnostic header".into()), + (28, "collapsed context".into()), + (29, "diagnostic header".into()), + (38, "collapsed context".into()), ] ); assert_eq!( @@ -1159,6 +1142,7 @@ mod tests { "const a: i32 = 'a';\n", "\n", // supporting diagnostic "const b: i32 = c;\n", + "\n", // context ellipsis // diagnostic group 2 "\n", // primary message "\n", // padding @@ -1184,6 +1168,7 @@ mod tests { " c(y);\n", "\n", // supporting diagnostic " d(x);\n", + "\n", // context ellipsis // diagnostic group 2 "\n", // primary message "\n", // filename @@ -1221,7 +1206,15 @@ mod tests { }) .name()? .to_string(), - TransformBlock::ExcerptHeader { .. } => "path header block".to_string(), + TransformBlock::ExcerptHeader { + starts_new_buffer, .. + } => { + if *starts_new_buffer { + "path header block".to_string() + } else { + "collapsed context".to_string() + } + } }; Some((row, name)) diff --git a/crates/editor/src/display_map.rs b/crates/editor/src/display_map.rs index 4659d66e562045888aff24f97199b378f6bdfe26..24fd53155886d5d980af6bec1639ed74113131e3 100644 --- a/crates/editor/src/display_map.rs +++ b/crates/editor/src/display_map.rs @@ -43,6 +43,7 @@ impl DisplayMap { font_id: FontId, font_size: f32, wrap_width: Option, + buffer_header_height: u8, excerpt_header_height: u8, cx: &mut ModelContext, ) -> Self { @@ -50,7 +51,7 @@ impl DisplayMap { let (fold_map, snapshot) = FoldMap::new(buffer.read(cx).snapshot(cx)); let (tab_map, snapshot) = TabMap::new(snapshot, tab_size); let (wrap_map, snapshot) = WrapMap::new(snapshot, font_id, font_size, wrap_width, cx); - let block_map = BlockMap::new(snapshot, excerpt_header_height); + let block_map = BlockMap::new(snapshot, buffer_header_height, excerpt_header_height); cx.observe(&wrap_map, |_, _, cx| cx.notify()).detach(); DisplayMap { buffer, @@ -472,6 +473,7 @@ mod tests { let font_cache = cx.font_cache().clone(); let tab_size = rng.gen_range(1..=4); + let buffer_start_excerpt_header_height = rng.gen_range(1..=5); let excerpt_header_height = rng.gen_range(1..=5); let family_id = font_cache.load_family(&["Helvetica"]).unwrap(); let font_id = font_cache @@ -505,6 +507,7 @@ mod tests { font_id, font_size, wrap_width, + buffer_start_excerpt_header_height, excerpt_header_height, cx, ) @@ -728,6 +731,7 @@ mod tests { font_size, wrap_width, 1, + 1, cx, ) }); @@ -809,7 +813,7 @@ mod tests { .unwrap(); let font_size = 14.0; let map = cx.add_model(|cx| { - DisplayMap::new(buffer.clone(), tab_size, font_id, font_size, None, 1, cx) + DisplayMap::new(buffer.clone(), tab_size, font_id, font_size, None, 1, 1, cx) }); buffer.update(cx, |buffer, cx| { buffer.edit( @@ -888,8 +892,8 @@ mod tests { .unwrap(); let font_size = 14.0; - let map = - cx.add_model(|cx| DisplayMap::new(buffer, tab_size, font_id, font_size, None, 1, cx)); + let map = cx + .add_model(|cx| DisplayMap::new(buffer, tab_size, font_id, font_size, None, 1, 1, cx)); assert_eq!( cx.update(|cx| chunks(0..5, &map, &theme, cx)), vec![ @@ -977,7 +981,7 @@ mod tests { let font_size = 16.0; let map = cx.add_model(|cx| { - DisplayMap::new(buffer, tab_size, font_id, font_size, Some(40.0), 1, cx) + DisplayMap::new(buffer, tab_size, font_id, font_size, Some(40.0), 1, 1, cx) }); assert_eq!( cx.update(|cx| chunks(0..5, &map, &theme, cx)), @@ -1022,7 +1026,7 @@ mod tests { .unwrap(); let font_size = 14.0; let map = cx.add_model(|cx| { - DisplayMap::new(buffer.clone(), tab_size, font_id, font_size, None, 1, cx) + DisplayMap::new(buffer.clone(), tab_size, font_id, font_size, None, 1, 1, cx) }); let map = map.update(cx, |map, cx| map.snapshot(cx)); @@ -1066,7 +1070,7 @@ mod tests { let font_size = 14.0; let map = cx.add_model(|cx| { - DisplayMap::new(buffer.clone(), tab_size, font_id, font_size, None, 1, cx) + DisplayMap::new(buffer.clone(), tab_size, font_id, font_size, None, 1, 1, cx) }); let map = map.update(cx, |map, cx| map.snapshot(cx)); assert_eq!(map.text(), "✅ α\nβ \n🏀β γ"); @@ -1124,7 +1128,7 @@ mod tests { .unwrap(); let font_size = 14.0; let map = cx.add_model(|cx| { - DisplayMap::new(buffer.clone(), tab_size, font_id, font_size, None, 1, cx) + DisplayMap::new(buffer.clone(), tab_size, font_id, font_size, None, 1, 1, cx) }); assert_eq!( map.update(cx, |map, cx| map.snapshot(cx)).max_point(), diff --git a/crates/editor/src/display_map/block_map.rs b/crates/editor/src/display_map/block_map.rs index df7f506c231aa0e5879202bad5c015067461386d..465e46af213aa42db30508ed956e3192b47773ad 100644 --- a/crates/editor/src/display_map/block_map.rs +++ b/crates/editor/src/display_map/block_map.rs @@ -24,6 +24,7 @@ pub struct BlockMap { wrap_snapshot: RefCell, blocks: Vec>, transforms: RefCell>, + buffer_header_height: u8, excerpt_header_height: u8, } @@ -150,13 +151,18 @@ pub struct BlockBufferRows<'a> { } impl BlockMap { - pub fn new(wrap_snapshot: WrapSnapshot, excerpt_header_height: u8) -> Self { + pub fn new( + wrap_snapshot: WrapSnapshot, + buffer_header_height: u8, + excerpt_header_height: u8, + ) -> Self { let row_count = wrap_snapshot.max_point().row() + 1; let map = Self { next_block_id: AtomicUsize::new(0), blocks: Vec::new(), transforms: RefCell::new(SumTree::from_item(Transform::isomorphic(row_count), &())), wrap_snapshot: RefCell::new(wrap_snapshot.clone()), + buffer_header_height, excerpt_header_height, }; map.sync( @@ -352,7 +358,11 @@ impl BlockMap { TransformBlock::ExcerptHeader { buffer: excerpt_boundary.buffer, range: excerpt_boundary.range, - height: self.excerpt_header_height, + height: if excerpt_boundary.starts_new_buffer { + self.buffer_header_height + } else { + self.excerpt_header_height + }, starts_new_buffer: excerpt_boundary.starts_new_buffer, }, ) @@ -980,7 +990,7 @@ mod tests { let (fold_map, folds_snapshot) = FoldMap::new(buffer_snapshot.clone()); let (tab_map, tabs_snapshot) = TabMap::new(folds_snapshot.clone(), 1); let (wrap_map, wraps_snapshot) = WrapMap::new(tabs_snapshot, font_id, 14.0, None, cx); - let mut block_map = BlockMap::new(wraps_snapshot.clone(), 1); + let mut block_map = BlockMap::new(wraps_snapshot.clone(), 1, 1); let mut writer = block_map.write(wraps_snapshot.clone(), Default::default()); writer.insert(vec![ @@ -1158,7 +1168,7 @@ mod tests { let (_, folds_snapshot) = FoldMap::new(buffer_snapshot.clone()); let (_, tabs_snapshot) = TabMap::new(folds_snapshot.clone(), 1); let (_, wraps_snapshot) = WrapMap::new(tabs_snapshot, font_id, 14.0, Some(60.), cx); - let mut block_map = BlockMap::new(wraps_snapshot.clone(), 1); + let mut block_map = BlockMap::new(wraps_snapshot.clone(), 1, 1); let mut writer = block_map.write(wraps_snapshot.clone(), Default::default()); writer.insert(vec![ @@ -1203,6 +1213,7 @@ mod tests { .select_font(family_id, &Default::default()) .unwrap(); let font_size = 14.0; + let buffer_start_header_height = rng.gen_range(1..=5); let excerpt_header_height = rng.gen_range(1..=5); log::info!("Wrap width: {:?}", wrap_width); @@ -1222,7 +1233,11 @@ mod tests { let (tab_map, tabs_snapshot) = TabMap::new(folds_snapshot.clone(), tab_size); let (wrap_map, wraps_snapshot) = WrapMap::new(tabs_snapshot, font_id, font_size, wrap_width, cx); - let mut block_map = BlockMap::new(wraps_snapshot.clone(), excerpt_header_height); + let mut block_map = BlockMap::new( + wraps_snapshot.clone(), + buffer_start_header_height, + excerpt_header_height, + ); let mut custom_blocks = Vec::new(); for _ in 0..operations { @@ -1350,7 +1365,11 @@ mod tests { ( position.row(), ExpectedBlock::ExcerptHeader { - height: excerpt_header_height, + height: if boundary.starts_new_buffer { + buffer_start_header_height + } else { + excerpt_header_height + }, starts_new_buffer: boundary.starts_new_buffer, }, ) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index c917e093434904613e636691791deca0454e2679..6044e8d548a59426c21509db602c2aee470fe6bb 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -810,6 +810,7 @@ impl Editor { settings.style.text.font_size, None, 2, + 1, cx, ) }); @@ -7892,21 +7893,23 @@ mod tests { build_editor(multibuffer, settings, cx) }); view.update(cx, |view, cx| { - view.select_display_ranges( - &[ - DisplayPoint::new(0, 0)..DisplayPoint::new(0, 0), - DisplayPoint::new(1, 0)..DisplayPoint::new(1, 0), + assert_eq!(view.text(cx), "aaaa\nbbbb"); + view.select_ranges( + [ + Point::new(0, 0)..Point::new(0, 0), + Point::new(1, 0)..Point::new(1, 0), ], + None, cx, ); view.handle_input(&Input("X".to_string()), cx); assert_eq!(view.text(cx), "Xaaaa\nXbbbb"); assert_eq!( - view.selected_display_ranges(cx), - &[ - DisplayPoint::new(0, 1)..DisplayPoint::new(0, 1), - DisplayPoint::new(1, 1)..DisplayPoint::new(1, 1), + view.selected_ranges(cx), + [ + Point::new(0, 1)..Point::new(0, 1), + Point::new(1, 1)..Point::new(1, 1), ] ) }); @@ -7944,31 +7947,32 @@ mod tests { build_editor(multibuffer, settings, cx) }); view.update(cx, |view, cx| { - view.select_display_ranges( - &[ - DisplayPoint::new(1, 1)..DisplayPoint::new(1, 1), - DisplayPoint::new(2, 3)..DisplayPoint::new(2, 3), + view.select_ranges( + [ + Point::new(1, 1)..Point::new(1, 1), + Point::new(2, 3)..Point::new(2, 3), ], + None, cx, ); view.handle_input(&Input("X".to_string()), cx); assert_eq!(view.text(cx), "aaaa\nbXbbXb\nbXbbXb\ncccc"); assert_eq!( - view.selected_display_ranges(cx), - &[ - DisplayPoint::new(1, 2)..DisplayPoint::new(1, 2), - DisplayPoint::new(2, 5)..DisplayPoint::new(2, 5), + view.selected_ranges(cx), + [ + Point::new(1, 2)..Point::new(1, 2), + Point::new(2, 5)..Point::new(2, 5), ] ); view.newline(&Newline, cx); assert_eq!(view.text(cx), "aaaa\nbX\nbbX\nb\nbX\nbbX\nb\ncccc"); assert_eq!( - view.selected_display_ranges(cx), - &[ - DisplayPoint::new(2, 0)..DisplayPoint::new(2, 0), - DisplayPoint::new(6, 0)..DisplayPoint::new(6, 0), + view.selected_ranges(cx), + [ + Point::new(2, 0)..Point::new(2, 0), + Point::new(6, 0)..Point::new(6, 0), ] ); }); @@ -8003,11 +8007,12 @@ mod tests { ); let (_, editor) = cx.add_window(Default::default(), |cx| { let mut editor = build_editor(multibuffer.clone(), settings, cx); - editor.select_display_ranges( - &[ - DisplayPoint::new(1, 3)..DisplayPoint::new(1, 3), - DisplayPoint::new(2, 1)..DisplayPoint::new(2, 1), + editor.select_ranges( + [ + Point::new(1, 3)..Point::new(1, 3), + Point::new(2, 1)..Point::new(2, 1), ], + None, cx, ); editor @@ -8017,10 +8022,10 @@ mod tests { editor.update(cx, |editor, cx| { editor.refresh_selections(cx); assert_eq!( - editor.selected_display_ranges(cx), + editor.selected_ranges(cx), [ - DisplayPoint::new(1, 3)..DisplayPoint::new(1, 3), - DisplayPoint::new(2, 1)..DisplayPoint::new(2, 1), + Point::new(1, 3)..Point::new(1, 3), + Point::new(2, 1)..Point::new(2, 1), ] ); }); @@ -8031,10 +8036,10 @@ mod tests { editor.update(cx, |editor, cx| { // Removing an excerpt causes the first selection to become degenerate. assert_eq!( - editor.selected_display_ranges(cx), + editor.selected_ranges(cx), [ - DisplayPoint::new(0, 0)..DisplayPoint::new(0, 0), - DisplayPoint::new(0, 1)..DisplayPoint::new(0, 1) + Point::new(0, 0)..Point::new(0, 0), + Point::new(0, 1)..Point::new(0, 1) ] ); @@ -8042,10 +8047,10 @@ mod tests { // location. editor.refresh_selections(cx); assert_eq!( - editor.selected_display_ranges(cx), + editor.selected_ranges(cx), [ - DisplayPoint::new(0, 1)..DisplayPoint::new(0, 1), - DisplayPoint::new(0, 3)..DisplayPoint::new(0, 3) + Point::new(0, 1)..Point::new(0, 1), + Point::new(0, 3)..Point::new(0, 3) ] ); }); diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 67f349dc8bf0766915d21cdcb404f1949457ec79..82365445e60ff53dad97aaf225dc3e7166b7f307 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -679,42 +679,59 @@ impl EditorElement { em_width, }) } - TransformBlock::ExcerptHeader { buffer, .. } => { - let style = &self.settings.style.diagnostic_path_header; - let font_size = - (style.text_scale_factor * self.settings.style.text.font_size).round(); - - let mut filename = None; - let mut parent_path = None; - if let Some(path) = buffer.path() { - filename = path.file_name().map(|f| f.to_string_lossy().to_string()); - parent_path = - path.parent().map(|p| p.to_string_lossy().to_string() + "/"); - } - - Flex::row() - .with_child( - Label::new( - filename.unwrap_or_else(|| "untitled".to_string()), - style.filename.text.clone().with_font_size(font_size), + TransformBlock::ExcerptHeader { + buffer, + starts_new_buffer, + .. + } => { + if *starts_new_buffer { + let style = &self.settings.style.diagnostic_path_header; + let font_size = (style.text_scale_factor + * self.settings.style.text.font_size) + .round(); + + let mut filename = None; + let mut parent_path = None; + if let Some(path) = buffer.path() { + filename = + path.file_name().map(|f| f.to_string_lossy().to_string()); + parent_path = + path.parent().map(|p| p.to_string_lossy().to_string() + "/"); + } + + Flex::row() + .with_child( + Label::new( + filename.unwrap_or_else(|| "untitled".to_string()), + style.filename.text.clone().with_font_size(font_size), + ) + .contained() + .with_style(style.filename.container) + .boxed(), ) - .contained() - .with_style(style.filename.container) - .boxed(), - ) - .with_children(parent_path.map(|path| { - Label::new(path, style.path.text.clone().with_font_size(font_size)) + .with_children(parent_path.map(|path| { + Label::new( + path, + style.path.text.clone().with_font_size(font_size), + ) .contained() .with_style(style.path.container) .boxed() - })) - .aligned() - .left() - .contained() - .with_style(style.container) - .with_padding_left(gutter_padding + scroll_x * em_width) - .expanded() - .named("path header block") + })) + .aligned() + .left() + .contained() + .with_style(style.container) + .with_padding_left(gutter_padding + scroll_x * em_width) + .expanded() + .named("path header block") + } else { + let text_style = self.settings.style.text.clone(); + Label::new("…".to_string(), text_style) + .contained() + .with_padding_left(gutter_padding + scroll_x * em_width) + .named("collapsed context") + } } }; diff --git a/crates/editor/src/movement.rs b/crates/editor/src/movement.rs index f4047a4cf5aff8645a4d13fb9111ee67da742786..47ff75b4faaa124334f87005b5e3e4a32b5f78f0 100644 --- a/crates/editor/src/movement.rs +++ b/crates/editor/src/movement.rs @@ -257,10 +257,10 @@ mod tests { }); let display_map = - cx.add_model(|cx| DisplayMap::new(multibuffer, 2, font_id, 14.0, None, 2, cx)); + cx.add_model(|cx| DisplayMap::new(multibuffer, 2, font_id, 14.0, None, 2, 2, cx)); let snapshot = display_map.update(cx, |map, cx| map.snapshot(cx)); - assert_eq!(snapshot.text(), "\n\nabc\ndefg\n\n\n\nhijkl\nmn"); + assert_eq!(snapshot.text(), "\n\nabc\ndefg\n\n\nhijkl\nmn"); // Can't move up into the first excerpt's header assert_eq!( @@ -284,22 +284,22 @@ mod tests { // Move up and down across second excerpt's header assert_eq!( - up(&snapshot, DisplayPoint::new(7, 5), SelectionGoal::Column(5)).unwrap(), + up(&snapshot, DisplayPoint::new(6, 5), SelectionGoal::Column(5)).unwrap(), (DisplayPoint::new(3, 4), SelectionGoal::Column(5)), ); assert_eq!( down(&snapshot, DisplayPoint::new(3, 4), SelectionGoal::Column(5)).unwrap(), - (DisplayPoint::new(7, 5), SelectionGoal::Column(5)), + (DisplayPoint::new(6, 5), SelectionGoal::Column(5)), ); // Can't move down off the end assert_eq!( - down(&snapshot, DisplayPoint::new(8, 0), SelectionGoal::Column(0)).unwrap(), - (DisplayPoint::new(8, 2), SelectionGoal::Column(2)), + down(&snapshot, DisplayPoint::new(7, 0), SelectionGoal::Column(0)).unwrap(), + (DisplayPoint::new(7, 2), SelectionGoal::Column(2)), ); assert_eq!( - down(&snapshot, DisplayPoint::new(8, 2), SelectionGoal::Column(2)).unwrap(), - (DisplayPoint::new(8, 2), SelectionGoal::Column(2)), + down(&snapshot, DisplayPoint::new(7, 2), SelectionGoal::Column(2)).unwrap(), + (DisplayPoint::new(7, 2), SelectionGoal::Column(2)), ); } @@ -314,8 +314,8 @@ mod tests { let font_size = 14.0; let buffer = MultiBuffer::build_simple("a bcΔ defγ hi—jk", cx); - let display_map = - cx.add_model(|cx| DisplayMap::new(buffer, tab_size, font_id, font_size, None, 1, cx)); + let display_map = cx + .add_model(|cx| DisplayMap::new(buffer, tab_size, font_id, font_size, None, 1, 1, cx)); let snapshot = display_map.update(cx, |map, cx| map.snapshot(cx)); assert_eq!( prev_word_boundary(&snapshot, DisplayPoint::new(0, 12)), @@ -370,8 +370,8 @@ mod tests { .unwrap(); let font_size = 14.0; let buffer = MultiBuffer::build_simple("lorem ipsum dolor\n sit", cx); - let display_map = - cx.add_model(|cx| DisplayMap::new(buffer, tab_size, font_id, font_size, None, 1, cx)); + let display_map = cx + .add_model(|cx| DisplayMap::new(buffer, tab_size, font_id, font_size, None, 1, 1, cx)); let snapshot = display_map.update(cx, |map, cx| map.snapshot(cx)); assert_eq!(