diff --git a/assets/icons/expand_down.svg b/assets/icons/expand_down.svg
new file mode 100644
index 0000000000..a17b9e285c
--- /dev/null
+++ b/assets/icons/expand_down.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/icons/expand_up.svg b/assets/icons/expand_up.svg
new file mode 100644
index 0000000000..30f9af92e3
--- /dev/null
+++ b/assets/icons/expand_up.svg
@@ -0,0 +1,4 @@
+
diff --git a/crates/assistant/src/inline_assistant.rs b/crates/assistant/src/inline_assistant.rs
index 7bf10d4a67..fb7343c18b 100644
--- a/crates/assistant/src/inline_assistant.rs
+++ b/crates/assistant/src/inline_assistant.rs
@@ -1246,7 +1246,7 @@ impl InlineAssistant {
});
enum DeletedLines {}
- let mut editor = Editor::for_multibuffer(multi_buffer, None, true, window, cx);
+ let mut editor = Editor::for_multibuffer(multi_buffer, None, window, cx);
editor.set_soft_wrap_mode(language::language_settings::SoftWrap::None, cx);
editor.set_show_wrap_guides(false, cx);
editor.set_show_gutter(false, cx);
@@ -1693,7 +1693,6 @@ impl PromptEditor {
},
prompt_buffer,
None,
- false,
window,
cx,
);
diff --git a/crates/assistant/src/terminal_inline_assistant.rs b/crates/assistant/src/terminal_inline_assistant.rs
index ba9a73b58e..1acbd5f414 100644
--- a/crates/assistant/src/terminal_inline_assistant.rs
+++ b/crates/assistant/src/terminal_inline_assistant.rs
@@ -720,7 +720,6 @@ impl PromptEditor {
},
prompt_buffer,
None,
- false,
window,
cx,
);
diff --git a/crates/assistant2/src/active_thread.rs b/crates/assistant2/src/active_thread.rs
index 2d9dbf5364..66b8f1f129 100644
--- a/crates/assistant2/src/active_thread.rs
+++ b/crates/assistant2/src/active_thread.rs
@@ -396,7 +396,6 @@ impl ActiveThread {
editor::EditorMode::AutoHeight { max_lines: 8 },
buffer,
None,
- false,
window,
cx,
);
diff --git a/crates/assistant2/src/assistant_panel.rs b/crates/assistant2/src/assistant_panel.rs
index 266ccb96ff..486931a9c3 100644
--- a/crates/assistant2/src/assistant_panel.rs
+++ b/crates/assistant2/src/assistant_panel.rs
@@ -456,13 +456,8 @@ impl AssistantPanel {
workspace.add_item_to_active_pane(
Box::new(cx.new(|cx| {
- let mut editor = Editor::for_multibuffer(
- buffer,
- Some(project.clone()),
- true,
- window,
- cx,
- );
+ let mut editor =
+ Editor::for_multibuffer(buffer, Some(project.clone()), window, cx);
editor.set_breadcrumb_header(thread_summary);
editor
})),
diff --git a/crates/assistant2/src/inline_assistant.rs b/crates/assistant2/src/inline_assistant.rs
index 74b8e49b8b..e76834da73 100644
--- a/crates/assistant2/src/inline_assistant.rs
+++ b/crates/assistant2/src/inline_assistant.rs
@@ -1341,7 +1341,7 @@ impl InlineAssistant {
});
enum DeletedLines {}
- let mut editor = Editor::for_multibuffer(multi_buffer, None, true, window, cx);
+ let mut editor = Editor::for_multibuffer(multi_buffer, None, window, cx);
editor.set_soft_wrap_mode(language::language_settings::SoftWrap::None, cx);
editor.set_show_wrap_guides(false, cx);
editor.set_show_gutter(false, cx);
diff --git a/crates/assistant2/src/inline_prompt_editor.rs b/crates/assistant2/src/inline_prompt_editor.rs
index d11a02be01..a2256574f2 100644
--- a/crates/assistant2/src/inline_prompt_editor.rs
+++ b/crates/assistant2/src/inline_prompt_editor.rs
@@ -843,7 +843,6 @@ impl PromptEditor {
},
prompt_buffer,
None,
- false,
window,
cx,
);
@@ -1001,7 +1000,6 @@ impl PromptEditor {
},
prompt_buffer,
None,
- false,
window,
cx,
);
diff --git a/crates/auto_update_ui/src/auto_update_ui.rs b/crates/auto_update_ui/src/auto_update_ui.rs
index adf55f1773..0ef89da85e 100644
--- a/crates/auto_update_ui/src/auto_update_ui.rs
+++ b/crates/auto_update_ui/src/auto_update_ui.rs
@@ -93,7 +93,7 @@ fn view_release_notes_locally(
let tab_description = SharedString::from(body.title.to_string());
let editor = cx.new(|cx| {
- Editor::for_multibuffer(buffer, Some(project), true, window, cx)
+ Editor::for_multibuffer(buffer, Some(project), window, cx)
});
let workspace_handle = workspace.weak_handle();
let markdown_preview: Entity =
diff --git a/crates/collab/src/tests/following_tests.rs b/crates/collab/src/tests/following_tests.rs
index dea74f80a2..fa5caf0116 100644
--- a/crates/collab/src/tests/following_tests.rs
+++ b/crates/collab/src/tests/following_tests.rs
@@ -313,9 +313,8 @@ async fn test_basic_following(
result
});
let multibuffer_editor_a = workspace_a.update_in(cx_a, |workspace, window, cx| {
- let editor = cx.new(|cx| {
- Editor::for_multibuffer(multibuffer_a, Some(project_a.clone()), true, window, cx)
- });
+ let editor = cx
+ .new(|cx| Editor::for_multibuffer(multibuffer_a, Some(project_a.clone()), window, cx));
workspace.add_item_to_active_pane(Box::new(editor.clone()), None, true, window, cx);
editor
});
diff --git a/crates/copilot/src/copilot_completion_provider.rs b/crates/copilot/src/copilot_completion_provider.rs
index 00e00f7670..95640f8527 100644
--- a/crates/copilot/src/copilot_completion_provider.rs
+++ b/crates/copilot/src/copilot_completion_provider.rs
@@ -745,8 +745,8 @@ mod tests {
);
multibuffer
});
- let editor = cx
- .add_window(|window, cx| Editor::for_multibuffer(multibuffer, None, true, window, cx));
+ let editor =
+ cx.add_window(|window, cx| Editor::for_multibuffer(multibuffer, None, window, cx));
editor
.update(cx, |editor, window, cx| {
use gpui::Focusable;
@@ -781,7 +781,7 @@ mod tests {
assert!(editor.has_active_inline_completion());
assert_eq!(
editor.display_text(cx),
- "\n\n\na = 1\nb = 2 + a\n\n\n\n\n\nc = 3\nd = 4\n\n"
+ "\n\na = 1\nb = 2 + a\n\n\n\nc = 3\nd = 4\n"
);
assert_eq!(editor.text(cx), "a = 1\nb = 2\n\nc = 3\nd = 4\n");
});
@@ -803,7 +803,7 @@ mod tests {
assert!(!editor.has_active_inline_completion());
assert_eq!(
editor.display_text(cx),
- "\n\n\na = 1\nb = 2\n\n\n\n\n\nc = 3\nd = 4\n\n"
+ "\n\na = 1\nb = 2\n\n\n\nc = 3\nd = 4\n"
);
assert_eq!(editor.text(cx), "a = 1\nb = 2\n\nc = 3\nd = 4\n");
@@ -812,7 +812,7 @@ mod tests {
assert!(!editor.has_active_inline_completion());
assert_eq!(
editor.display_text(cx),
- "\n\n\na = 1\nb = 2\n\n\n\n\n\nc = 3\nd = 4 \n\n"
+ "\n\na = 1\nb = 2\n\n\n\nc = 3\nd = 4 \n"
);
assert_eq!(editor.text(cx), "a = 1\nb = 2\n\nc = 3\nd = 4 \n");
});
@@ -823,7 +823,7 @@ mod tests {
assert!(editor.has_active_inline_completion());
assert_eq!(
editor.display_text(cx),
- "\n\n\na = 1\nb = 2\n\n\n\n\n\nc = 3\nd = 4 + c\n\n"
+ "\n\na = 1\nb = 2\n\n\n\nc = 3\nd = 4 + c\n"
);
assert_eq!(editor.text(cx), "a = 1\nb = 2\n\nc = 3\nd = 4 \n");
});
@@ -997,8 +997,8 @@ mod tests {
);
multibuffer
});
- let editor = cx
- .add_window(|window, cx| Editor::for_multibuffer(multibuffer, None, true, window, cx));
+ let editor =
+ cx.add_window(|window, cx| Editor::for_multibuffer(multibuffer, None, window, cx));
editor
.update(cx, |editor, window, cx| {
use gpui::Focusable;
diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rs
index 169946ce0e..99b2dc91a1 100644
--- a/crates/diagnostics/src/diagnostics.rs
+++ b/crates/diagnostics/src/diagnostics.rs
@@ -198,13 +198,8 @@ impl ProjectDiagnosticsEditor {
let excerpts = cx.new(|cx| MultiBuffer::new(project_handle.read(cx).capability()));
let editor = cx.new(|cx| {
- let mut editor = Editor::for_multibuffer(
- excerpts.clone(),
- Some(project_handle.clone()),
- true,
- window,
- cx,
- );
+ let mut editor =
+ Editor::for_multibuffer(excerpts.clone(), Some(project_handle.clone()), window, cx);
editor.set_vertical_scroll_margin(5, cx);
editor.disable_inline_diagnostics();
editor
diff --git a/crates/diagnostics/src/diagnostics_tests.rs b/crates/diagnostics/src/diagnostics_tests.rs
index 550aea56a3..e6c1132154 100644
--- a/crates/diagnostics/src/diagnostics_tests.rs
+++ b/crates/diagnostics/src/diagnostics_tests.rs
@@ -169,10 +169,10 @@ async fn test_diagnostics(cx: &mut TestAppContext) {
editor_blocks(&editor, cx),
[
(DisplayRow(0), FILE_HEADER.into()),
- (DisplayRow(3), DIAGNOSTIC_HEADER.into()),
- (DisplayRow(16), EXCERPT_HEADER.into()),
- (DisplayRow(18), DIAGNOSTIC_HEADER.into()),
- (DisplayRow(27), EXCERPT_HEADER.into()),
+ (DisplayRow(2), DIAGNOSTIC_HEADER.into()),
+ (DisplayRow(15), EXCERPT_HEADER.into()),
+ (DisplayRow(16), DIAGNOSTIC_HEADER.into()),
+ (DisplayRow(25), EXCERPT_HEADER.into()),
]
);
assert_eq!(
@@ -186,7 +186,6 @@ async fn test_diagnostics(cx: &mut TestAppContext) {
// diagnostic group 1
"\n", // primary message
"\n", // padding
- "\n", // expand
" let x = vec![];\n",
" let y = vec![];\n",
"\n", // supporting diagnostic
@@ -198,7 +197,6 @@ async fn test_diagnostics(cx: &mut TestAppContext) {
" c(y);\n",
"\n", // supporting diagnostic
" d(x);\n",
- "\n", // expand
"\n", // context ellipsis
// diagnostic group 2
"\n", // primary message
@@ -210,13 +208,11 @@ async fn test_diagnostics(cx: &mut TestAppContext) {
" a(x);\n",
"\n", // supporting diagnostic
" b(y);\n",
- "\n", // expand
"\n", // context ellipsis
" c(y);\n",
" d(x);\n",
"\n", // supporting diagnostic
"}",
- "\n", // expand
)
);
@@ -224,7 +220,7 @@ async fn test_diagnostics(cx: &mut TestAppContext) {
editor.update(cx, |editor, cx| {
assert_eq!(
editor.selections.display_ranges(cx),
- [DisplayPoint::new(DisplayRow(13), 6)..DisplayPoint::new(DisplayRow(13), 6)]
+ [DisplayPoint::new(DisplayRow(12), 6)..DisplayPoint::new(DisplayRow(12), 6)]
);
});
@@ -260,12 +256,12 @@ async fn test_diagnostics(cx: &mut TestAppContext) {
editor_blocks(&editor, cx),
[
(DisplayRow(0), FILE_HEADER.into()),
- (DisplayRow(3), DIAGNOSTIC_HEADER.into()),
- (DisplayRow(8), FILE_HEADER.into()),
- (DisplayRow(12), DIAGNOSTIC_HEADER.into()),
- (DisplayRow(25), EXCERPT_HEADER.into()),
- (DisplayRow(27), DIAGNOSTIC_HEADER.into()),
- (DisplayRow(36), EXCERPT_HEADER.into()),
+ (DisplayRow(2), DIAGNOSTIC_HEADER.into()),
+ (DisplayRow(7), FILE_HEADER.into()),
+ (DisplayRow(9), DIAGNOSTIC_HEADER.into()),
+ (DisplayRow(22), EXCERPT_HEADER.into()),
+ (DisplayRow(23), DIAGNOSTIC_HEADER.into()),
+ (DisplayRow(32), EXCERPT_HEADER.into()),
]
);
@@ -280,7 +276,6 @@ async fn test_diagnostics(cx: &mut TestAppContext) {
// diagnostic group 1
"\n", // primary message
"\n", // padding
- "\n", // expand
"const a: i32 = 'a';\n",
"\n", // supporting diagnostic
"const b: i32 = c;\n",
@@ -292,8 +287,6 @@ async fn test_diagnostics(cx: &mut TestAppContext) {
// diagnostic group 1
"\n", // primary message
"\n", // padding
- "\n", // expand
- "\n", // expand
" let x = vec![];\n",
" let y = vec![];\n",
"\n", // supporting diagnostic
@@ -309,7 +302,6 @@ async fn test_diagnostics(cx: &mut TestAppContext) {
// diagnostic group 2
"\n", // primary message
"\n", // filename
- "\n", // expand
"fn main() {\n",
" let x = vec![];\n",
"\n", // supporting diagnostic
@@ -317,13 +309,11 @@ async fn test_diagnostics(cx: &mut TestAppContext) {
" a(x);\n",
"\n", // supporting diagnostic
" b(y);\n",
- "\n", // expand
"\n", // context ellipsis
" c(y);\n",
" d(x);\n",
"\n", // supporting diagnostic
"}",
- "\n", // expand
)
);
@@ -331,7 +321,7 @@ async fn test_diagnostics(cx: &mut TestAppContext) {
editor.update(cx, |editor, cx| {
assert_eq!(
editor.selections.display_ranges(cx),
- [DisplayPoint::new(DisplayRow(22), 6)..DisplayPoint::new(DisplayRow(22), 6)]
+ [DisplayPoint::new(DisplayRow(19), 6)..DisplayPoint::new(DisplayRow(19), 6)]
);
});
@@ -380,14 +370,14 @@ async fn test_diagnostics(cx: &mut TestAppContext) {
editor_blocks(&editor, cx),
[
(DisplayRow(0), FILE_HEADER.into()),
- (DisplayRow(3), DIAGNOSTIC_HEADER.into()),
- (DisplayRow(8), EXCERPT_HEADER.into()),
- (DisplayRow(10), DIAGNOSTIC_HEADER.into()),
- (DisplayRow(15), FILE_HEADER.into()),
- (DisplayRow(19), DIAGNOSTIC_HEADER.into()),
- (DisplayRow(32), EXCERPT_HEADER.into()),
- (DisplayRow(34), DIAGNOSTIC_HEADER.into()),
- (DisplayRow(43), EXCERPT_HEADER.into()),
+ (DisplayRow(2), DIAGNOSTIC_HEADER.into()),
+ (DisplayRow(7), EXCERPT_HEADER.into()),
+ (DisplayRow(8), DIAGNOSTIC_HEADER.into()),
+ (DisplayRow(13), FILE_HEADER.into()),
+ (DisplayRow(15), DIAGNOSTIC_HEADER.into()),
+ (DisplayRow(28), EXCERPT_HEADER.into()),
+ (DisplayRow(29), DIAGNOSTIC_HEADER.into()),
+ (DisplayRow(38), EXCERPT_HEADER.into()),
]
);
@@ -402,7 +392,6 @@ async fn test_diagnostics(cx: &mut TestAppContext) {
// diagnostic group 1
"\n", // primary message
"\n", // padding
- "\n", // expand
"const a: i32 = 'a';\n",
"\n", // supporting diagnostic
"const b: i32 = c;\n",
@@ -410,7 +399,6 @@ async fn test_diagnostics(cx: &mut TestAppContext) {
// diagnostic group 2
"\n", // primary message
"\n", // padding
- "\n", // expand
"const a: i32 = 'a';\n",
"const b: i32 = c;\n",
"\n", // supporting diagnostic
@@ -422,8 +410,6 @@ async fn test_diagnostics(cx: &mut TestAppContext) {
// diagnostic group 1
"\n", // primary message
"\n", // padding
- "\n", // expand
- "\n", // expand
" let x = vec![];\n",
" let y = vec![];\n",
"\n", // supporting diagnostic
@@ -439,7 +425,6 @@ async fn test_diagnostics(cx: &mut TestAppContext) {
// diagnostic group 2
"\n", // primary message
"\n", // filename
- "\n", // expand
"fn main() {\n",
" let x = vec![];\n",
"\n", // supporting diagnostic
@@ -447,13 +432,11 @@ async fn test_diagnostics(cx: &mut TestAppContext) {
" a(x);\n",
"\n", // supporting diagnostic
" b(y);\n",
- "\n", // expand
"\n", // context ellipsis
" c(y);\n",
" d(x);\n",
"\n", // supporting diagnostic
"}",
- "\n", // expand
)
);
}
@@ -535,7 +518,7 @@ async fn test_diagnostics_multiple_servers(cx: &mut TestAppContext) {
editor_blocks(&editor, cx),
[
(DisplayRow(0), FILE_HEADER.into()),
- (DisplayRow(3), DIAGNOSTIC_HEADER.into()),
+ (DisplayRow(2), DIAGNOSTIC_HEADER.into()),
]
);
assert_eq!(
@@ -546,9 +529,8 @@ async fn test_diagnostics_multiple_servers(cx: &mut TestAppContext) {
// diagnostic group 1
"\n", // primary message
"\n", // padding
- "\n", // expand
"a();\n", //
- "b();", "\n", // expand
+ "b();",
)
);
@@ -584,9 +566,9 @@ async fn test_diagnostics_multiple_servers(cx: &mut TestAppContext) {
editor_blocks(&editor, cx),
[
(DisplayRow(0), FILE_HEADER.into()),
- (DisplayRow(3), DIAGNOSTIC_HEADER.into()),
- (DisplayRow(7), EXCERPT_HEADER.into()),
- (DisplayRow(9), DIAGNOSTIC_HEADER.into()),
+ (DisplayRow(2), DIAGNOSTIC_HEADER.into()),
+ (DisplayRow(6), EXCERPT_HEADER.into()),
+ (DisplayRow(7), DIAGNOSTIC_HEADER.into()),
]
);
assert_eq!(
@@ -597,10 +579,8 @@ async fn test_diagnostics_multiple_servers(cx: &mut TestAppContext) {
// diagnostic group 1
"\n", // primary message
"\n", // padding
- "\n", // expand
"a();\n", // location
"b();\n", //
- "\n", // expand
"\n", // collapsed context
// diagnostic group 2
"\n", // primary message
@@ -608,7 +588,6 @@ async fn test_diagnostics_multiple_servers(cx: &mut TestAppContext) {
"a();\n", // context
"b();\n", //
"c();", // context
- "\n", // expand
)
);
@@ -655,9 +634,9 @@ async fn test_diagnostics_multiple_servers(cx: &mut TestAppContext) {
editor_blocks(&editor, cx),
[
(DisplayRow(0), FILE_HEADER.into()),
- (DisplayRow(3), DIAGNOSTIC_HEADER.into()),
- (DisplayRow(8), EXCERPT_HEADER.into()),
- (DisplayRow(10), DIAGNOSTIC_HEADER.into()),
+ (DisplayRow(2), DIAGNOSTIC_HEADER.into()),
+ (DisplayRow(7), EXCERPT_HEADER.into()),
+ (DisplayRow(8), DIAGNOSTIC_HEADER.into()),
]
);
assert_eq!(
@@ -668,11 +647,9 @@ async fn test_diagnostics_multiple_servers(cx: &mut TestAppContext) {
// diagnostic group 1
"\n", // primary message
"\n", // padding
- "\n", // expand
"a();\n", // location
"b();\n", //
"c();\n", // context
- "\n", // expand
"\n", // collapsed context
// diagnostic group 2
"\n", // primary message
@@ -680,7 +657,6 @@ async fn test_diagnostics_multiple_servers(cx: &mut TestAppContext) {
"b();\n", // context
"c();\n", //
"d();", // context
- "\n", // expand
)
);
@@ -716,9 +692,9 @@ async fn test_diagnostics_multiple_servers(cx: &mut TestAppContext) {
editor_blocks(&editor, cx),
[
(DisplayRow(0), FILE_HEADER.into()),
- (DisplayRow(3), DIAGNOSTIC_HEADER.into()),
- (DisplayRow(8), EXCERPT_HEADER.into()),
- (DisplayRow(10), DIAGNOSTIC_HEADER.into()),
+ (DisplayRow(2), DIAGNOSTIC_HEADER.into()),
+ (DisplayRow(7), EXCERPT_HEADER.into()),
+ (DisplayRow(8), DIAGNOSTIC_HEADER.into()),
]
);
assert_eq!(
@@ -729,11 +705,9 @@ async fn test_diagnostics_multiple_servers(cx: &mut TestAppContext) {
// diagnostic group 1
"\n", // primary message
"\n", // padding
- "\n", // expand
"b();\n", // location
"c();\n", //
"d();\n", // context
- "\n", // expand
"\n", // collapsed context
// diagnostic group 2
"\n", // primary message
@@ -741,7 +715,6 @@ async fn test_diagnostics_multiple_servers(cx: &mut TestAppContext) {
"c();\n", // context
"d();\n", //
"e();", // context
- "\n", // expand
)
);
}
diff --git a/crates/editor/src/display_map.rs b/crates/editor/src/display_map.rs
index 11615f2f0a..04ec72206a 100644
--- a/crates/editor/src/display_map.rs
+++ b/crates/editor/src/display_map.rs
@@ -118,10 +118,8 @@ impl DisplayMap {
font: Font,
font_size: Pixels,
wrap_width: Option,
- show_excerpt_controls: bool,
buffer_header_height: u32,
excerpt_header_height: u32,
- excerpt_footer_height: u32,
fold_placeholder: FoldPlaceholder,
cx: &mut Context,
) -> Self {
@@ -134,13 +132,7 @@ impl DisplayMap {
let (fold_map, snapshot) = FoldMap::new(snapshot);
let (tab_map, snapshot) = TabMap::new(snapshot, tab_size);
let (wrap_map, snapshot) = WrapMap::new(snapshot, font, font_size, wrap_width, cx);
- let block_map = BlockMap::new(
- snapshot,
- show_excerpt_controls,
- buffer_header_height,
- excerpt_header_height,
- excerpt_footer_height,
- );
+ let block_map = BlockMap::new(snapshot, buffer_header_height, excerpt_header_height);
cx.observe(&wrap_map, |_, _, cx| cx.notify()).detach();
@@ -555,10 +547,6 @@ impl DisplayMap {
pub fn is_rewrapping(&self, cx: &gpui::App) -> bool {
self.wrap_map.read(cx).is_rewrapping()
}
-
- pub fn show_excerpt_controls(&self) -> bool {
- self.block_map.show_excerpt_controls()
- }
}
#[derive(Debug, Default)]
@@ -1102,8 +1090,8 @@ impl DisplaySnapshot {
.map(|(row, block)| (DisplayRow(row), block))
}
- pub fn sticky_header_excerpt(&self, row: DisplayRow) -> Option> {
- self.block_snapshot.sticky_header_excerpt(row.0)
+ pub fn sticky_header_excerpt(&self, row: f32) -> Option> {
+ self.block_snapshot.sticky_header_excerpt(row)
}
pub fn block_for_id(&self, id: BlockId) -> Option {
@@ -1301,10 +1289,6 @@ impl DisplaySnapshot {
self.block_snapshot.buffer_header_height
}
- pub fn excerpt_footer_height(&self) -> u32 {
- self.block_snapshot.excerpt_footer_height
- }
-
pub fn excerpt_header_height(&self) -> u32 {
self.block_snapshot.excerpt_header_height
}
@@ -1514,10 +1498,8 @@ pub mod tests {
font,
font_size,
wrap_width,
- true,
buffer_start_excerpt_header_height,
excerpt_header_height,
- 0,
FoldPlaceholder::test(),
cx,
)
@@ -1764,10 +1746,8 @@ pub mod tests {
font("Helvetica"),
font_size,
wrap_width,
- true,
1,
1,
- 0,
FoldPlaceholder::test(),
cx,
)
@@ -1875,10 +1855,8 @@ pub mod tests {
font("Helvetica"),
font_size,
None,
- true,
1,
1,
- 0,
FoldPlaceholder::test(),
cx,
)
@@ -1938,8 +1916,6 @@ pub mod tests {
font("Helvetica"),
font_size,
None,
- true,
- 1,
1,
1,
FoldPlaceholder::test(),
@@ -2032,8 +2008,6 @@ pub mod tests {
font("Helvetica"),
font_size,
None,
- true,
- 1,
1,
1,
FoldPlaceholder::test(),
@@ -2134,10 +2108,8 @@ pub mod tests {
font("Courier"),
px(16.0),
None,
- true,
1,
1,
- 0,
FoldPlaceholder::test(),
cx,
)
@@ -2239,10 +2211,8 @@ pub mod tests {
font("Courier"),
px(16.0),
None,
- true,
1,
1,
- 0,
FoldPlaceholder::test(),
cx,
)
@@ -2328,10 +2298,8 @@ pub mod tests {
font("Courier"),
px(16.0),
None,
- true,
1,
1,
- 0,
FoldPlaceholder::test(),
cx,
)
@@ -2472,10 +2440,8 @@ pub mod tests {
font("Courier"),
font_size,
Some(px(40.0)),
- true,
1,
1,
- 0,
FoldPlaceholder::test(),
cx,
)
@@ -2556,8 +2522,6 @@ pub mod tests {
font("Courier"),
font_size,
None,
- true,
- 1,
1,
1,
FoldPlaceholder::test(),
@@ -2682,10 +2646,8 @@ pub mod tests {
font("Helvetica"),
font_size,
None,
- true,
1,
1,
- 0,
FoldPlaceholder::test(),
cx,
);
@@ -2721,10 +2683,8 @@ pub mod tests {
font("Helvetica"),
font_size,
None,
- true,
1,
1,
- 0,
FoldPlaceholder::test(),
cx,
)
@@ -2798,10 +2758,8 @@ pub mod tests {
font("Helvetica"),
font_size,
None,
- true,
1,
1,
- 0,
FoldPlaceholder::test(),
cx,
)
diff --git a/crates/editor/src/display_map/block_map.rs b/crates/editor/src/display_map/block_map.rs
index ab8b87b0ad..69e6df8666 100644
--- a/crates/editor/src/display_map/block_map.rs
+++ b/crates/editor/src/display_map/block_map.rs
@@ -37,10 +37,8 @@ pub struct BlockMap {
custom_blocks: Vec>,
custom_blocks_by_id: TreeMap>,
transforms: RefCell>,
- show_excerpt_controls: bool,
buffer_header_height: u32,
excerpt_header_height: u32,
- excerpt_footer_height: u32,
pub(super) folded_buffers: HashSet,
}
@@ -58,7 +56,6 @@ pub struct BlockSnapshot {
custom_blocks_by_id: TreeMap>,
pub(super) buffer_header_height: u32,
pub(super) excerpt_header_height: u32,
- pub(super) excerpt_footer_height: u32,
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
@@ -285,14 +282,12 @@ pub enum Block {
first_excerpt: ExcerptInfo,
prev_excerpt: Option,
height: u32,
- show_excerpt_controls: bool,
},
ExcerptBoundary {
prev_excerpt: Option,
next_excerpt: Option,
height: u32,
starts_new_buffer: bool,
- show_excerpt_controls: bool,
},
}
@@ -362,13 +357,11 @@ impl Debug for Block {
first_excerpt,
prev_excerpt,
height,
- show_excerpt_controls,
} => f
.debug_struct("FoldedBuffer")
.field("first_excerpt", &first_excerpt)
.field("prev_excerpt", prev_excerpt)
.field("height", height)
- .field("show_excerpt_controls", show_excerpt_controls)
.finish(),
Self::ExcerptBoundary {
starts_new_buffer,
@@ -413,10 +406,8 @@ pub struct BlockRows<'a> {
impl BlockMap {
pub fn new(
wrap_snapshot: WrapSnapshot,
- show_excerpt_controls: bool,
buffer_header_height: u32,
excerpt_header_height: u32,
- excerpt_footer_height: u32,
) -> Self {
let row_count = wrap_snapshot.max_point().row() + 1;
let mut transforms = SumTree::default();
@@ -428,10 +419,8 @@ impl BlockMap {
folded_buffers: HashSet::default(),
transforms: RefCell::new(transforms),
wrap_snapshot: RefCell::new(wrap_snapshot.clone()),
- show_excerpt_controls,
buffer_header_height,
excerpt_header_height,
- excerpt_footer_height,
};
map.sync(
&wrap_snapshot,
@@ -454,7 +443,6 @@ impl BlockMap {
custom_blocks_by_id: self.custom_blocks_by_id.clone(),
buffer_header_height: self.buffer_header_height,
excerpt_header_height: self.excerpt_header_height,
- excerpt_footer_height: self.excerpt_footer_height,
},
}
}
@@ -650,8 +638,6 @@ impl BlockMap {
if buffer.show_headers() {
blocks_in_edit.extend(BlockMap::header_and_footer_blocks(
- self.show_excerpt_controls,
- self.excerpt_footer_height,
self.buffer_header_height,
self.excerpt_header_height,
buffer,
@@ -722,13 +708,7 @@ impl BlockMap {
}
}
- pub fn show_excerpt_controls(&self) -> bool {
- self.show_excerpt_controls
- }
-
fn header_and_footer_blocks<'a, R, T>(
- show_excerpt_controls: bool,
- excerpt_footer_height: u32,
buffer_header_height: u32,
excerpt_header_height: u32,
buffer: &'a multi_buffer::MultiBufferSnapshot,
@@ -774,11 +754,6 @@ impl BlockMap {
.filter(|prev| !folded_buffers.contains(&prev.buffer_id));
let mut height = 0;
- if prev_excerpt.is_some() {
- if show_excerpt_controls {
- height += excerpt_footer_height;
- }
- }
if let Some(new_buffer_id) = new_buffer_id {
let first_excerpt = excerpt_boundary.next.clone().unwrap();
@@ -812,7 +787,6 @@ impl BlockMap {
Block::FoldedBuffer {
prev_excerpt,
height: height + buffer_header_height,
- show_excerpt_controls,
first_excerpt,
},
));
@@ -822,9 +796,6 @@ impl BlockMap {
if excerpt_boundary.next.is_some() {
if new_buffer_id.is_some() {
height += buffer_header_height;
- if show_excerpt_controls {
- height += excerpt_header_height;
- }
} else {
height += excerpt_header_height;
}
@@ -845,7 +816,6 @@ impl BlockMap {
next_excerpt: excerpt_boundary.next,
height,
starts_new_buffer: new_buffer_id.is_some(),
- show_excerpt_controls,
},
))
})
@@ -1432,7 +1402,8 @@ impl BlockSnapshot {
})
}
- pub fn sticky_header_excerpt(&self, top_row: u32) -> Option> {
+ pub fn sticky_header_excerpt(&self, position: f32) -> Option> {
+ let top_row = position as u32;
let mut cursor = self.transforms.cursor::(&());
cursor.seek(&BlockRow(top_row), Bias::Left, &());
@@ -1445,19 +1416,13 @@ impl BlockSnapshot {
prev_excerpt,
next_excerpt,
starts_new_buffer,
- show_excerpt_controls,
..
}) => {
- let matches_start = if *show_excerpt_controls && prev_excerpt.is_some() {
- start < top_row
- } else {
- start <= top_row
- };
+ let matches_start = (start as f32) < position;
if matches_start && top_row <= end {
return next_excerpt.as_ref().map(|excerpt| StickyHeaderExcerpt {
next_buffer_row: None,
- next_excerpt_controls_present: *show_excerpt_controls,
excerpt,
});
}
@@ -1467,7 +1432,6 @@ impl BlockSnapshot {
return prev_excerpt.as_ref().map(|excerpt| StickyHeaderExcerpt {
excerpt,
next_buffer_row,
- next_excerpt_controls_present: *show_excerpt_controls,
});
}
Some(Block::FoldedBuffer {
@@ -1476,7 +1440,6 @@ impl BlockSnapshot {
}) if top_row <= start => {
return Some(StickyHeaderExcerpt {
next_buffer_row: Some(end),
- next_excerpt_controls_present: false,
excerpt,
});
}
@@ -1785,7 +1748,6 @@ impl BlockChunks<'_> {
pub struct StickyHeaderExcerpt<'a> {
pub excerpt: &'a ExcerptInfo,
- pub next_excerpt_controls_present: bool,
pub next_buffer_row: Option,
}
@@ -2066,7 +2028,7 @@ mod tests {
let (mut tab_map, tab_snapshot) = TabMap::new(fold_snapshot, 1.try_into().unwrap());
let (wrap_map, wraps_snapshot) =
cx.update(|cx| WrapMap::new(tab_snapshot, font("Helvetica"), px(14.0), None, cx));
- let mut block_map = BlockMap::new(wraps_snapshot.clone(), true, 1, 1, 1);
+ let mut block_map = BlockMap::new(wraps_snapshot.clone(), 1, 1);
let mut writer = block_map.write(wraps_snapshot.clone(), Default::default());
let block_ids = writer.insert(vec![
@@ -2279,14 +2241,11 @@ mod tests {
let (_, tab_snapshot) = TabMap::new(fold_snapshot, 4.try_into().unwrap());
let (_, wraps_snapshot) = WrapMap::new(tab_snapshot, font, font_size, Some(wrap_width), cx);
- let block_map = BlockMap::new(wraps_snapshot.clone(), true, 1, 1, 1);
+ let block_map = BlockMap::new(wraps_snapshot.clone(), 1, 1);
let snapshot = block_map.read(wraps_snapshot, Default::default());
// Each excerpt has a header above and footer below. Excerpts are also *separated* by a newline.
- assert_eq!(
- snapshot.text(),
- "\n\nBuff\ner 1\n\n\n\nBuff\ner 2\n\n\n\nBuff\ner 3\n"
- );
+ assert_eq!(snapshot.text(), "\nBuff\ner 1\n\nBuff\ner 2\n\nBuff\ner 3");
let blocks: Vec<_> = snapshot
.blocks_in_range(0..u32::MAX)
@@ -2295,10 +2254,9 @@ mod tests {
assert_eq!(
blocks,
vec![
- (0..2, BlockId::ExcerptBoundary(Some(excerpt_ids[0]))), // path, header
- (4..7, BlockId::ExcerptBoundary(Some(excerpt_ids[1]))), // footer, path, header
- (9..12, BlockId::ExcerptBoundary(Some(excerpt_ids[2]))), // footer, path, header
- (14..15, BlockId::ExcerptBoundary(None)), // footer
+ (0..1, BlockId::ExcerptBoundary(Some(excerpt_ids[0]))), // path, header
+ (3..4, BlockId::ExcerptBoundary(Some(excerpt_ids[1]))), // path, header
+ (6..7, BlockId::ExcerptBoundary(Some(excerpt_ids[2]))), // path, header
]
);
}
@@ -2317,7 +2275,7 @@ mod tests {
let (_tab_map, tab_snapshot) = TabMap::new(fold_snapshot, 1.try_into().unwrap());
let (_wrap_map, wraps_snapshot) =
cx.update(|cx| WrapMap::new(tab_snapshot, font("Helvetica"), px(14.0), None, cx));
- let mut block_map = BlockMap::new(wraps_snapshot.clone(), false, 1, 1, 0);
+ let mut block_map = BlockMap::new(wraps_snapshot.clone(), 1, 1);
let mut writer = block_map.write(wraps_snapshot.clone(), Default::default());
let block_ids = writer.insert(vec![
@@ -2420,7 +2378,7 @@ mod tests {
let (_, wraps_snapshot) = cx.update(|cx| {
WrapMap::new(tab_snapshot, font("Helvetica"), px(14.0), Some(px(60.)), cx)
});
- let mut block_map = BlockMap::new(wraps_snapshot.clone(), true, 1, 1, 0);
+ 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![
@@ -2464,7 +2422,7 @@ mod tests {
let (mut tab_map, tab_snapshot) = TabMap::new(fold_snapshot, tab_size);
let (wrap_map, wraps_snapshot) =
cx.update(|cx| WrapMap::new(tab_snapshot, font("Helvetica"), px(14.0), None, cx));
- let mut block_map = BlockMap::new(wraps_snapshot.clone(), false, 1, 1, 0);
+ let mut block_map = BlockMap::new(wraps_snapshot.clone(), 1, 1);
let mut writer = block_map.write(wraps_snapshot.clone(), Default::default());
let replace_block_id = writer.insert(vec![BlockProperties {
@@ -2631,12 +2589,12 @@ mod tests {
let (_, tab_snapshot) = TabMap::new(fold_snapshot, 4.try_into().unwrap());
let (_, wrap_snapshot) =
cx.update(|cx| WrapMap::new(tab_snapshot, font("Helvetica"), px(14.0), None, cx));
- let mut block_map = BlockMap::new(wrap_snapshot.clone(), true, 2, 1, 1);
+ let mut block_map = BlockMap::new(wrap_snapshot.clone(), 2, 1);
let blocks_snapshot = block_map.read(wrap_snapshot.clone(), Patch::default());
assert_eq!(
blocks_snapshot.text(),
- "\n\n\n111\n\n\n\n\n222\n\n\n333\n\n\n444\n\n\n\n\n555\n\n\n666\n"
+ "\n\n111\n\n\n222\n\n333\n\n444\n\n\n555\n\n666"
);
assert_eq!(
blocks_snapshot
@@ -2644,30 +2602,21 @@ mod tests {
.map(|i| i.buffer_row)
.collect::>(),
vec![
- None,
None,
None,
Some(0),
None,
None,
- None,
- None,
Some(1),
None,
- None,
Some(2),
None,
- None,
Some(3),
None,
None,
- None,
- None,
Some(4),
None,
- None,
Some(5),
- None,
]
);
@@ -2715,7 +2664,7 @@ mod tests {
let blocks_snapshot = block_map.read(wrap_snapshot.clone(), Patch::default());
assert_eq!(
blocks_snapshot.text(),
- "\n\n\n111\n\n\n\n\n\n222\n\n\n\n333\n\n\n444\n\n\n\n\n\n\n555\n\n\n666\n\n"
+ "\n\n111\n\n\n\n222\n\n\n333\n\n444\n\n\n\n\n555\n\n666\n"
);
assert_eq!(
blocks_snapshot
@@ -2723,35 +2672,26 @@ mod tests {
.map(|i| i.buffer_row)
.collect::>(),
vec![
- None,
None,
None,
Some(0),
None,
None,
None,
- None,
- None,
Some(1),
None,
None,
- None,
Some(2),
None,
- None,
Some(3),
None,
None,
None,
None,
- None,
- None,
Some(4),
None,
- None,
Some(5),
None,
- None,
]
);
@@ -2793,7 +2733,7 @@ mod tests {
);
assert_eq!(
blocks_snapshot.text(),
- "\n\n\n\n\n\n222\n\n\n\n333\n\n\n444\n\n\n\n\n\n\n555\n\n\n666\n\n"
+ "\n\n\n\n\n222\n\n\n333\n\n444\n\n\n\n\n555\n\n666\n"
);
assert_eq!(
blocks_snapshot
@@ -2806,27 +2746,20 @@ mod tests {
None,
None,
None,
- None,
Some(1),
None,
None,
- None,
Some(2),
None,
- None,
Some(3),
None,
None,
None,
None,
- None,
- None,
Some(4),
None,
- None,
Some(5),
None,
- None,
]
);
@@ -2862,7 +2795,7 @@ mod tests {
.count(),
"Should have two folded blocks, producing headers"
);
- assert_eq!(blocks_snapshot.text(), "\n\n\n\n\n\n\n\n555\n\n\n666\n\n");
+ assert_eq!(blocks_snapshot.text(), "\n\n\n\n\n\n\n555\n\n666\n");
assert_eq!(
blocks_snapshot
.row_infos(BlockRow(0))
@@ -2876,13 +2809,10 @@ mod tests {
None,
None,
None,
- None,
Some(4),
None,
- None,
Some(5),
None,
- None,
]
);
@@ -2917,7 +2847,7 @@ mod tests {
);
assert_eq!(
blocks_snapshot.text(),
- "\n\n\n\n111\n\n\n\n\n\n\n\n555\n\n\n666\n\n",
+ "\n\n\n111\n\n\n\n\n\n555\n\n666\n",
"Should have extra newline for 111 buffer, due to a new block added when it was folded"
);
assert_eq!(
@@ -2929,21 +2859,16 @@ mod tests {
None,
None,
None,
- None,
Some(0),
None,
None,
None,
None,
None,
- None,
- None,
Some(4),
None,
- None,
Some(5),
None,
- None,
]
);
@@ -2974,7 +2899,7 @@ mod tests {
assert_eq!(
blocks_snapshot.text(),
- "\n\n\n\n111\n\n\n\n\n",
+ "\n\n\n111\n\n\n\n",
"Should have a single, first buffer left after folding"
);
assert_eq!(
@@ -2982,18 +2907,7 @@ mod tests {
.row_infos(BlockRow(0))
.map(|i| i.buffer_row)
.collect::>(),
- vec![
- None,
- None,
- None,
- None,
- Some(0),
- None,
- None,
- None,
- None,
- None,
- ]
+ vec![None, None, None, Some(0), None, None, None, None,]
);
}
@@ -3020,10 +2934,10 @@ mod tests {
let (_, tab_snapshot) = TabMap::new(fold_snapshot, 4.try_into().unwrap());
let (_, wrap_snapshot) =
cx.update(|cx| WrapMap::new(tab_snapshot, font("Helvetica"), px(14.0), None, cx));
- let mut block_map = BlockMap::new(wrap_snapshot.clone(), true, 2, 1, 1);
+ let mut block_map = BlockMap::new(wrap_snapshot.clone(), 2, 1);
let blocks_snapshot = block_map.read(wrap_snapshot.clone(), Patch::default());
- assert_eq!(blocks_snapshot.text(), "\n\n\n111\n");
+ assert_eq!(blocks_snapshot.text(), "\n\n111");
let mut writer = block_map.write(wrap_snapshot.clone(), Patch::default());
buffer.read_with(cx, |buffer, cx| {
@@ -3077,11 +2991,9 @@ mod tests {
let font_size = px(14.0);
let buffer_start_header_height = rng.gen_range(1..=5);
let excerpt_header_height = rng.gen_range(1..=5);
- let excerpt_footer_height = rng.gen_range(1..=5);
log::info!("Wrap width: {:?}", wrap_width);
log::info!("Excerpt Header Height: {:?}", excerpt_header_height);
- log::info!("Excerpt Footer Height: {:?}", excerpt_footer_height);
let is_singleton = rng.gen();
let buffer = if is_singleton {
let len = rng.gen_range(0..10);
@@ -3108,10 +3020,8 @@ mod tests {
cx.update(|cx| WrapMap::new(tab_snapshot, font, font_size, wrap_width, cx));
let mut block_map = BlockMap::new(
wraps_snapshot,
- true,
buffer_start_header_height,
excerpt_header_height,
- excerpt_footer_height,
);
for _ in 0..operations {
@@ -3329,8 +3239,6 @@ mod tests {
// Note that this needs to be synced with the related section in BlockMap::sync
expected_blocks.extend(BlockMap::header_and_footer_blocks(
- true,
- excerpt_footer_height,
buffer_start_header_height,
excerpt_header_height,
&buffer_snapshot,
diff --git a/crates/editor/src/display_map/wrap_map.rs b/crates/editor/src/display_map/wrap_map.rs
index f52d5b70f3..8396c05b90 100644
--- a/crates/editor/src/display_map/wrap_map.rs
+++ b/crates/editor/src/display_map/wrap_map.rs
@@ -983,6 +983,7 @@ impl Iterator for WrapRows<'_> {
buffer_row: None,
multibuffer_row: None,
diff_status,
+ expand_info: None,
}
} else {
buffer_row
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs
index 998955b4ba..c043491f00 100644
--- a/crates/editor/src/editor.rs
+++ b/crates/editor/src/editor.rs
@@ -196,7 +196,6 @@ use crate::signature_help::{SignatureHelpHiddenBy, SignatureHelpState};
pub const FILE_HEADER_HEIGHT: u32 = 2;
pub const MULTI_BUFFER_EXCERPT_HEADER_HEIGHT: u32 = 1;
-pub const MULTI_BUFFER_EXCERPT_FOOTER_HEIGHT: u32 = 1;
pub const DEFAULT_MULTIBUFFER_CONTEXT: u32 = 2;
const CURSOR_BLINK_INTERVAL: Duration = Duration::from_millis(500);
const MAX_LINE_LEN: usize = 1024;
@@ -1092,7 +1091,6 @@ impl Editor {
EditorMode::SingleLine { auto_width: false },
buffer,
None,
- false,
window,
cx,
)
@@ -1101,7 +1099,7 @@ impl Editor {
pub fn multi_line(window: &mut Window, cx: &mut Context) -> Self {
let buffer = cx.new(|cx| Buffer::local("", cx));
let buffer = cx.new(|cx| MultiBuffer::singleton(buffer, cx));
- Self::new(EditorMode::Full, buffer, None, false, window, cx)
+ Self::new(EditorMode::Full, buffer, None, window, cx)
}
pub fn auto_width(window: &mut Window, cx: &mut Context) -> Self {
@@ -1111,7 +1109,6 @@ impl Editor {
EditorMode::SingleLine { auto_width: true },
buffer,
None,
- false,
window,
cx,
)
@@ -1124,7 +1121,6 @@ impl Editor {
EditorMode::AutoHeight { max_lines },
buffer,
None,
- false,
window,
cx,
)
@@ -1137,33 +1133,23 @@ impl Editor {
cx: &mut Context,
) -> Self {
let buffer = cx.new(|cx| MultiBuffer::singleton(buffer, cx));
- Self::new(EditorMode::Full, buffer, project, false, window, cx)
+ Self::new(EditorMode::Full, buffer, project, window, cx)
}
pub fn for_multibuffer(
buffer: Entity,
project: Option>,
- show_excerpt_controls: bool,
window: &mut Window,
cx: &mut Context,
) -> Self {
- Self::new(
- EditorMode::Full,
- buffer,
- project,
- show_excerpt_controls,
- window,
- cx,
- )
+ Self::new(EditorMode::Full, buffer, project, window, cx)
}
pub fn clone(&self, window: &mut Window, cx: &mut Context) -> Self {
- let show_excerpt_controls = self.display_map.read(cx).show_excerpt_controls();
let mut clone = Self::new(
self.mode,
self.buffer.clone(),
self.project.clone(),
- show_excerpt_controls,
window,
cx,
);
@@ -1183,7 +1169,6 @@ impl Editor {
mode: EditorMode,
buffer: Entity,
project: Option>,
- show_excerpt_controls: bool,
window: &mut Window,
cx: &mut Context,
) -> Self {
@@ -1228,10 +1213,8 @@ impl Editor {
style.font(),
font_size,
None,
- show_excerpt_controls,
FILE_HEADER_HEIGHT,
MULTI_BUFFER_EXCERPT_HEADER_HEIGHT,
- MULTI_BUFFER_EXCERPT_FOOTER_HEIGHT,
fold_placeholder,
cx,
)
@@ -4693,8 +4676,8 @@ impl Editor {
workspace.update_in(&mut cx, |workspace, window, cx| {
let project = workspace.project().clone();
- let editor = cx
- .new(|cx| Editor::for_multibuffer(excerpt_buffer, Some(project), true, window, cx));
+ let editor =
+ cx.new(|cx| Editor::for_multibuffer(excerpt_buffer, Some(project), window, cx));
workspace.add_item_to_active_pane(Box::new(editor.clone()), None, true, window, cx);
editor.update(cx, |editor, cx| {
editor.highlight_background::(
@@ -12381,7 +12364,6 @@ impl Editor {
Editor::for_multibuffer(
excerpt_buffer,
Some(workspace.project().clone()),
- true,
window,
cx,
)
diff --git a/crates/editor/src/editor_tests.rs b/crates/editor/src/editor_tests.rs
index 318e6ede48..90c9842359 100644
--- a/crates/editor/src/editor_tests.rs
+++ b/crates/editor/src/editor_tests.rs
@@ -7676,7 +7676,6 @@ async fn test_multibuffer_format_during_save(cx: &mut TestAppContext) {
EditorMode::Full,
multi_buffer,
Some(project.clone()),
- true,
window,
cx,
)
@@ -13501,7 +13500,6 @@ async fn test_mutlibuffer_in_navigation_history(cx: &mut TestAppContext) {
EditorMode::Full,
multi_buffer,
Some(project.clone()),
- true,
window,
cx,
)
@@ -13984,9 +13982,8 @@ async fn test_toggle_diff_expand_in_multi_buffer(cx: &mut TestAppContext) {
multibuffer
});
- let editor = cx.add_window(|window, cx| {
- Editor::new(EditorMode::Full, multi_buffer, None, true, window, cx)
- });
+ let editor =
+ cx.add_window(|window, cx| Editor::new(EditorMode::Full, multi_buffer, None, window, cx));
editor
.update(cx, |editor, _window, cx| {
for (buffer, diff_base) in [
@@ -14105,9 +14102,8 @@ async fn test_expand_diff_hunk_at_excerpt_boundary(cx: &mut TestAppContext) {
multibuffer
});
- let editor = cx.add_window(|window, cx| {
- Editor::new(EditorMode::Full, multi_buffer, None, true, window, cx)
- });
+ let editor =
+ cx.add_window(|window, cx| Editor::new(EditorMode::Full, multi_buffer, None, window, cx));
editor
.update(cx, |editor, _window, cx| {
let diff = cx.new(|cx| BufferDiff::new_with_base_text(base, &buffer, cx));
@@ -15663,14 +15659,7 @@ async fn test_display_diff_hunks(cx: &mut TestAppContext) {
});
let editor = cx.add_window(|window, cx| {
- Editor::new(
- EditorMode::Full,
- multibuffer,
- Some(project),
- true,
- window,
- cx,
- )
+ Editor::new(EditorMode::Full, multibuffer, Some(project), window, cx)
});
cx.run_until_parked();
@@ -15689,9 +15678,9 @@ async fn test_display_diff_hunks(cx: &mut TestAppContext) {
assert_eq!(
hunks,
[
- DisplayRow(3)..DisplayRow(5),
- DisplayRow(10)..DisplayRow(12),
- DisplayRow(17)..DisplayRow(19),
+ DisplayRow(2)..DisplayRow(4),
+ DisplayRow(7)..DisplayRow(9),
+ DisplayRow(12)..DisplayRow(14),
]
);
}
@@ -16122,7 +16111,6 @@ async fn test_find_enclosing_node_with_task(cx: &mut TestAppContext) {
EditorMode::Full,
multi_buffer,
Some(project.clone()),
- true,
window,
cx,
)
@@ -16277,7 +16265,6 @@ async fn test_folding_buffers(cx: &mut TestAppContext) {
EditorMode::Full,
multi_buffer.clone(),
Some(project.clone()),
- true,
window,
cx,
)
@@ -16285,7 +16272,7 @@ async fn test_folding_buffers(cx: &mut TestAppContext) {
assert_eq!(
multi_buffer_editor.update(cx, |editor, cx| editor.display_text(cx)),
- "\n\n\naaaa\nbbbb\ncccc\n\n\n\nffff\ngggg\n\n\n\njjjj\n\n\n\n\nllll\nmmmm\nnnnn\n\n\n\nqqqq\nrrrr\n\n\n\nuuuu\n\n\n\n\nvvvv\nwwww\nxxxx\n\n\n\n1111\n2222\n\n\n\n5555\n",
+ "\n\naaaa\nbbbb\ncccc\n\n\nffff\ngggg\n\n\njjjj\n\n\nllll\nmmmm\nnnnn\n\n\nqqqq\nrrrr\n\n\nuuuu\n\n\nvvvv\nwwww\nxxxx\n\n\n1111\n2222\n\n\n5555",
);
multi_buffer_editor.update(cx, |editor, cx| {
@@ -16293,7 +16280,7 @@ async fn test_folding_buffers(cx: &mut TestAppContext) {
});
assert_eq!(
multi_buffer_editor.update(cx, |editor, cx| editor.display_text(cx)),
- "\n\n\n\n\nllll\nmmmm\nnnnn\n\n\n\nqqqq\nrrrr\n\n\n\nuuuu\n\n\n\n\nvvvv\nwwww\nxxxx\n\n\n\n1111\n2222\n\n\n\n5555\n",
+ "\n\n\n\nllll\nmmmm\nnnnn\n\n\nqqqq\nrrrr\n\n\nuuuu\n\n\nvvvv\nwwww\nxxxx\n\n\n1111\n2222\n\n\n5555",
"After folding the first buffer, its text should not be displayed"
);
@@ -16302,7 +16289,7 @@ async fn test_folding_buffers(cx: &mut TestAppContext) {
});
assert_eq!(
multi_buffer_editor.update(cx, |editor, cx| editor.display_text(cx)),
- "\n\n\n\n\n\n\nvvvv\nwwww\nxxxx\n\n\n\n1111\n2222\n\n\n\n5555\n",
+ "\n\n\n\n\n\nvvvv\nwwww\nxxxx\n\n\n1111\n2222\n\n\n5555",
"After folding the second buffer, its text should not be displayed"
);
@@ -16327,7 +16314,7 @@ async fn test_folding_buffers(cx: &mut TestAppContext) {
});
assert_eq!(
multi_buffer_editor.update(cx, |editor, cx| editor.display_text(cx)),
- "\n\n\n\n\nllll\nmmmm\nnnnn\n\n\n\nqqqq\nrrrr\n\n\n\nuuuu\n\n\n",
+ "\n\n\n\nllll\nmmmm\nnnnn\n\n\nqqqq\nrrrr\n\n\nuuuu\n\n",
"After unfolding the second buffer, its text should be displayed"
);
@@ -16349,7 +16336,7 @@ async fn test_folding_buffers(cx: &mut TestAppContext) {
assert_eq!(
multi_buffer_editor.update(cx, |editor, cx| editor.display_text(cx)),
- "\n\n\nB\n\n\n\n\n\n\n\n\n\n\nllll\nmmmm\nnnnn\n\n\n\nqqqq\nrrrr\n\n\n\nuuuu\n\n\n",
+ "\n\nB\n\n\n\n\n\n\nllll\nmmmm\nnnnn\n\n\nqqqq\nrrrr\n\n\nuuuu\n\n",
"After unfolding the first buffer, its and 2nd buffer's text should be displayed"
);
@@ -16358,7 +16345,7 @@ async fn test_folding_buffers(cx: &mut TestAppContext) {
});
assert_eq!(
multi_buffer_editor.update(cx, |editor, cx| editor.display_text(cx)),
- "\n\n\nB\n\n\n\n\n\n\n\n\n\n\nllll\nmmmm\nnnnn\n\n\n\nqqqq\nrrrr\n\n\n\nuuuu\n\n\n\n\nvvvv\nwwww\nxxxx\n\n\n\n1111\n2222\n\n\n\n5555\n",
+ "\n\nB\n\n\n\n\n\n\nllll\nmmmm\nnnnn\n\n\nqqqq\nrrrr\n\n\nuuuu\n\n\nvvvv\nwwww\nxxxx\n\n\n1111\n2222\n\n\n5555",
"After unfolding the all buffers, all original text should be displayed"
);
}
@@ -16444,13 +16431,12 @@ async fn test_folding_buffers_with_one_excerpt(cx: &mut TestAppContext) {
EditorMode::Full,
multi_buffer,
Some(project.clone()),
- true,
window,
cx,
)
});
- let full_text = "\n\n\n1111\n2222\n3333\n\n\n\n\n4444\n5555\n6666\n\n\n\n\n7777\n8888\n9999\n";
+ let full_text = "\n\n1111\n2222\n3333\n\n\n4444\n5555\n6666\n\n\n7777\n8888\n9999";
assert_eq!(
multi_buffer_editor.update(cx, |editor, cx| editor.display_text(cx)),
full_text,
@@ -16461,7 +16447,7 @@ async fn test_folding_buffers_with_one_excerpt(cx: &mut TestAppContext) {
});
assert_eq!(
multi_buffer_editor.update(cx, |editor, cx| editor.display_text(cx)),
- "\n\n\n\n\n4444\n5555\n6666\n\n\n\n\n7777\n8888\n9999\n",
+ "\n\n\n\n4444\n5555\n6666\n\n\n7777\n8888\n9999",
"After folding the first buffer, its text should not be displayed"
);
@@ -16471,7 +16457,7 @@ async fn test_folding_buffers_with_one_excerpt(cx: &mut TestAppContext) {
assert_eq!(
multi_buffer_editor.update(cx, |editor, cx| editor.display_text(cx)),
- "\n\n\n\n\n\n\n7777\n8888\n9999\n",
+ "\n\n\n\n\n\n7777\n8888\n9999",
"After folding the second buffer, its text should not be displayed"
);
@@ -16489,7 +16475,7 @@ async fn test_folding_buffers_with_one_excerpt(cx: &mut TestAppContext) {
});
assert_eq!(
multi_buffer_editor.update(cx, |editor, cx| editor.display_text(cx)),
- "\n\n\n\n\n4444\n5555\n6666\n\n\n",
+ "\n\n\n\n4444\n5555\n6666\n\n",
"After unfolding the second buffer, its text should be displayed"
);
@@ -16498,7 +16484,7 @@ async fn test_folding_buffers_with_one_excerpt(cx: &mut TestAppContext) {
});
assert_eq!(
multi_buffer_editor.update(cx, |editor, cx| editor.display_text(cx)),
- "\n\n\n1111\n2222\n3333\n\n\n\n\n4444\n5555\n6666\n\n\n",
+ "\n\n1111\n2222\n3333\n\n\n4444\n5555\n6666\n\n",
"After unfolding the first buffer, its text should be displayed"
);
@@ -16564,7 +16550,6 @@ async fn test_folding_buffer_when_multibuffer_has_only_one_excerpt(cx: &mut Test
EditorMode::Full,
multi_buffer,
Some(project.clone()),
- true,
window,
cx,
)
@@ -16583,7 +16568,7 @@ async fn test_folding_buffer_when_multibuffer_has_only_one_excerpt(cx: &mut Test
editor.change_selections(None, window, cx, |s| s.select_ranges(Some(highlight_range)));
});
- let full_text = format!("\n\n\n{sample_text}\n");
+ let full_text = format!("\n\n{sample_text}");
assert_eq!(
multi_buffer_editor.update(cx, |editor, cx| editor.display_text(cx)),
full_text,
@@ -16612,14 +16597,7 @@ async fn test_multi_buffer_navigation_with_folded_buffers(cx: &mut TestAppContex
],
cx,
);
- let mut editor = Editor::new(
- EditorMode::Full,
- multi_buffer.clone(),
- None,
- true,
- window,
- cx,
- );
+ let mut editor = Editor::new(EditorMode::Full, multi_buffer.clone(), None, window, cx);
let buffer_ids = multi_buffer.read(cx).excerpt_buffer_ids();
// fold all but the second buffer, so that we test navigating between two
@@ -16931,7 +16909,7 @@ async fn assert_highlighted_edits(
) {
let window = cx.add_window(|window, cx| {
let buffer = MultiBuffer::build_simple(text, cx);
- Editor::new(EditorMode::Full, buffer, None, true, window, cx)
+ Editor::new(EditorMode::Full, buffer, None, window, cx)
});
let cx = &mut VisualTestContext::from_window(*window, cx);
diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs
index 6c02eb2c74..b55f656dc6 100644
--- a/crates/editor/src/element.rs
+++ b/crates/editor/src/element.rs
@@ -18,12 +18,12 @@ use crate::{
scroll::{axis_pair, scroll_amount::ScrollAmount, AxisPair},
BlockId, ChunkReplacement, CursorShape, CustomBlockId, DisplayDiffHunk, DisplayPoint,
DisplayRow, DocumentHighlightRead, DocumentHighlightWrite, EditDisplayMode, Editor, EditorMode,
- EditorSettings, EditorSnapshot, EditorStyle, ExpandExcerpts, FocusedBlock, GoToHunk,
- GoToPreviousHunk, GutterDimensions, HalfPageDown, HalfPageUp, HandleInput, HoveredCursor,
- InlayHintRefreshReason, InlineCompletion, JumpData, LineDown, LineHighlight, LineUp,
- OpenExcerpts, PageDown, PageUp, Point, RowExt, RowRangeExt, SelectPhase, SelectedTextHighlight,
- Selection, SoftWrap, StickyHeaderExcerpt, ToPoint, ToggleFold, COLUMNAR_SELECTION_MODIFIERS,
- CURSORS_VISIBLE_FOR, FILE_HEADER_HEIGHT, GIT_BLAME_MAX_AUTHOR_CHARS_DISPLAYED, MAX_LINE_LEN,
+ EditorSettings, EditorSnapshot, EditorStyle, FocusedBlock, GoToHunk, GoToPreviousHunk,
+ GutterDimensions, HalfPageDown, HalfPageUp, HandleInput, HoveredCursor, InlayHintRefreshReason,
+ InlineCompletion, JumpData, LineDown, LineHighlight, LineUp, OpenExcerpts, PageDown, PageUp,
+ Point, RowExt, RowRangeExt, SelectPhase, SelectedTextHighlight, Selection, SoftWrap,
+ StickyHeaderExcerpt, ToPoint, ToggleFold, COLUMNAR_SELECTION_MODIFIERS, CURSORS_VISIBLE_FOR,
+ FILE_HEADER_HEIGHT, GIT_BLAME_MAX_AUTHOR_CHARS_DISPLAYED, MAX_LINE_LEN,
MULTI_BUFFER_EXCERPT_HEADER_HEIGHT,
};
use buffer_diff::{DiffHunkStatus, DiffHunkStatusKind};
@@ -33,10 +33,10 @@ use file_icons::FileIcons;
use git::{blame::BlameEntry, status::FileStatus, Oid};
use gpui::{
anchored, deferred, div, fill, linear_color_stop, linear_gradient, outline, point, px, quad,
- relative, size, solid_background, svg, transparent_black, Action, AnyElement, App,
- AvailableSpace, Axis, Bounds, ClickEvent, ClipboardItem, ContentMask, Context, Corner, Corners,
- CursorStyle, DispatchPhase, Edges, Element, ElementInputHandler, Entity, Focusable as _,
- FontId, GlobalElementId, Hitbox, Hsla, InteractiveElement, IntoElement, Keystroke, Length,
+ relative, size, solid_background, transparent_black, Action, AnyElement, App, AvailableSpace,
+ Axis, Bounds, ClickEvent, ClipboardItem, ContentMask, Context, Corner, Corners, CursorStyle,
+ DispatchPhase, Edges, Element, ElementInputHandler, Entity, Focusable as _, FontId,
+ GlobalElementId, Hitbox, Hsla, InteractiveElement, IntoElement, Keystroke, Length,
ModifiersChangedEvent, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent, PaintQuad,
ParentElement, Pixels, ScrollDelta, ScrollWheelEvent, ShapedLine, SharedString, Size,
StatefulInteractiveElement, Style, Styled, Subscription, TextRun, TextStyleRefinement, Window,
@@ -52,8 +52,8 @@ use language::{
};
use lsp::DiagnosticSeverity;
use multi_buffer::{
- Anchor, ExcerptId, ExcerptInfo, ExpandExcerptDirection, MultiBufferPoint, MultiBufferRow,
- RowInfo,
+ Anchor, ExcerptId, ExcerptInfo, ExpandExcerptDirection, ExpandInfo, MultiBufferPoint,
+ MultiBufferRow, RowInfo,
};
use project::project_settings::{self, GitGutterSetting, ProjectSettings};
use settings::Settings;
@@ -72,7 +72,7 @@ use sum_tree::Bias;
use text::BufferId;
use theme::{ActiveTheme, Appearance, BufferLineHeight, PlayerColor};
use ui::{
- h_flex, prelude::*, ButtonLike, ButtonStyle, ContextMenu, IconButtonShape, KeyBinding, Tooltip,
+ h_flex, prelude::*, ButtonLike, ContextMenu, IconButtonShape, KeyBinding, Tooltip,
POPOVER_Y_PADDING,
};
use unicode_segmentation::UnicodeSegmentation;
@@ -1515,6 +1515,19 @@ impl EditorElement {
}
}
+ fn prepaint_expand_toggles(
+ &self,
+ expand_toggles: &mut [Option<(AnyElement, gpui::Point)>],
+ window: &mut Window,
+ cx: &mut App,
+ ) {
+ for (expand_toggle, origin) in expand_toggles.iter_mut().flatten() {
+ let available_space = size(AvailableSpace::MinContent, AvailableSpace::MinContent);
+ expand_toggle.layout_as_root(available_space, window, cx);
+ expand_toggle.prepaint_as_root(*origin, available_space, window, cx);
+ }
+ }
+
fn prepaint_crease_trailers(
&self,
trailers: Vec