diff --git a/assets/icons/diff_stacked.svg b/assets/icons/diff_unified.svg similarity index 100% rename from assets/icons/diff_stacked.svg rename to assets/icons/diff_unified.svg diff --git a/assets/settings/default.json b/assets/settings/default.json index b9be729d425ebd542c47a9c4815a789fd56e8080..838d6c3f85db3589d6907a81d1413d829fda68ae 100644 --- a/assets/settings/default.json +++ b/assets/settings/default.json @@ -293,8 +293,8 @@ "completion_detail_alignment": "left", // How to display diffs in the editor. // - // Default: stacked - "diff_view_style": "stacked", + // Default: unified + "diff_view_style": "unified", // Show method signatures in the editor, when inside parentheses. "auto_signature_help": false, // Whether to show the signature help after completion or a bracket pair inserted. diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 463f96f844a6e6034f25fff0951e555403456d6f..4cdd03463da34839e8ae929c5fa243df71cf8de9 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -78,7 +78,7 @@ pub use multi_buffer::{ MultiBufferOffset, MultiBufferOffsetUtf16, MultiBufferSnapshot, PathKey, RowInfo, ToOffset, ToPoint, }; -pub use split::{SplitDiffFeatureFlag, SplittableEditor, ToggleDiffView}; +pub use split::{SplitDiffFeatureFlag, SplittableEditor, ToggleSplitDiff}; pub use split_editor_view::SplitEditorView; pub use text::Bias; diff --git a/crates/editor/src/scroll.rs b/crates/editor/src/scroll.rs index c862a43cf95911600ba732c7086f0a9338ee94c8..0c275278389c3c1b8aff26dcdeaf09eaa9b419e7 100644 --- a/crates/editor/src/scroll.rs +++ b/crates/editor/src/scroll.rs @@ -70,7 +70,7 @@ pub struct OngoingScroll { axis: Option, } -/// In the side-by-side diff view, the two sides share a ScrollAnchor using this struct. +/// In the split diff view, the two sides share a ScrollAnchor using this struct. /// Either side can set a ScrollAnchor that points to its own multibuffer, and we store the ID of the display map /// that the last-written anchor came from so that we know how to resolve it to a DisplayPoint. /// @@ -196,7 +196,7 @@ pub struct ScrollManager { anchor: Entity, /// Value to be used for clamping the x component of the SharedScrollAnchor's offset. /// - /// We store this outside the SharedScrollAnchor so that the two sides of a side-by-side diff can share + /// We store this outside the SharedScrollAnchor so that the two sides of a split diff can share /// a horizontal scroll offset that may be out of range for one of the editors (when one side is wider than the other). /// Each side separately clamps the x component using its own scroll_max_x when reading from the SharedScrollAnchor. scroll_max_x: Option, @@ -286,7 +286,7 @@ impl ScrollManager { /// Get a ScrollAnchor whose `anchor` field is guaranteed to point into the multibuffer for the provided snapshot. /// - /// For normal editors, this just retrieves the internal ScrollAnchor and is lossless. When the editor is part of a side-by-side diff, + /// For normal editors, this just retrieves the internal ScrollAnchor and is lossless. When the editor is part of a split diff, /// we may need to translate the anchor to point to the "native" multibuffer first. That translation is lossy, /// so this method should be used sparingly---if you just need a scroll position or display point, call the appropriate helper method instead, /// since they can losslessly handle the case where the ScrollAnchor was last set from the other side. diff --git a/crates/editor/src/split.rs b/crates/editor/src/split.rs index e5b8d32818474f5a0926997789ac02b32d6ba4c7..1e1d6785bbfb2400922b9e566f200b556c78435e 100644 --- a/crates/editor/src/split.rs +++ b/crates/editor/src/split.rs @@ -374,7 +374,7 @@ impl FeatureFlag for SplitDiffFeatureFlag { #[derive(Clone, Copy, PartialEq, Eq, Action, Default)] #[action(namespace = editor)] -pub struct ToggleDiffView; +pub struct ToggleSplitDiff; pub struct SplittableEditor { rhs_multibuffer: Entity, @@ -492,7 +492,7 @@ impl SplittableEditor { .ok(); }) .ok(); - if style == DiffViewStyle::SideBySide { + if style == DiffViewStyle::Split { this.update(cx, |this, cx| { this.split(window, cx); }) @@ -836,7 +836,7 @@ impl SplittableEditor { }); } - fn toggle_split(&mut self, _: &ToggleDiffView, window: &mut Window, cx: &mut Context) { + fn toggle_split(&mut self, _: &ToggleSplitDiff, window: &mut Window, cx: &mut Context) { if self.lhs.is_some() { self.unsplit(window, cx); } else { @@ -2208,7 +2208,7 @@ mod tests { async fn test_random_split_editor(mut rng: StdRng, cx: &mut gpui::TestAppContext) { use rand::prelude::*; - let (editor, cx) = init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::SideBySide).await; + let (editor, cx) = init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::Split).await; let operations = std::env::var("OPERATIONS") .map(|i| i.parse().expect("invalid `OPERATIONS` variable")) .unwrap_or(10); @@ -2292,8 +2292,7 @@ mod tests { use rope::Point; use unindent::Unindent as _; - let (editor, mut cx) = - init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::SideBySide).await; + let (editor, mut cx) = init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::Split).await; let base_text = " aaa @@ -2422,8 +2421,7 @@ mod tests { use rope::Point; use unindent::Unindent as _; - let (editor, mut cx) = - init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::SideBySide).await; + let (editor, mut cx) = init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::Split).await; let base_text1 = " aaa @@ -2581,8 +2579,7 @@ mod tests { use rope::Point; use unindent::Unindent as _; - let (editor, mut cx) = - init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::SideBySide).await; + let (editor, mut cx) = init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::Split).await; let base_text = " aaa @@ -2701,8 +2698,7 @@ mod tests { use rope::Point; use unindent::Unindent as _; - let (editor, mut cx) = - init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::SideBySide).await; + let (editor, mut cx) = init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::Split).await; let base_text = " aaa @@ -2831,8 +2827,7 @@ mod tests { use rope::Point; use unindent::Unindent as _; - let (editor, mut cx) = - init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::SideBySide).await; + let (editor, mut cx) = init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::Split).await; let base_text = " aaa @@ -2957,8 +2952,7 @@ mod tests { use rope::Point; use unindent::Unindent as _; - let (editor, mut cx) = - init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::SideBySide).await; + let (editor, mut cx) = init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::Split).await; let base_text = " aaa @@ -3071,8 +3065,7 @@ mod tests { use rope::Point; use unindent::Unindent as _; - let (editor, mut cx) = - init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::SideBySide).await; + let (editor, mut cx) = init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::Split).await; let text = "aaaa bbbb cccc dddd eeee ffff"; @@ -3140,8 +3133,7 @@ mod tests { use rope::Point; use unindent::Unindent as _; - let (editor, mut cx) = - init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::SideBySide).await; + let (editor, mut cx) = init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::Split).await; let base_text = " aaaa bbbb cccc dddd eeee ffff @@ -3203,8 +3195,7 @@ mod tests { use rope::Point; use unindent::Unindent as _; - let (editor, mut cx) = - init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::SideBySide).await; + let (editor, mut cx) = init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::Split).await; let base_text = " aaaa bbbb cccc dddd eeee ffff @@ -3273,8 +3264,7 @@ mod tests { use rope::Point; use unindent::Unindent as _; - let (editor, mut cx) = - init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::SideBySide).await; + let (editor, mut cx) = init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::Split).await; let text = " aaaa bbbb cccc dddd eeee ffff @@ -3386,8 +3376,7 @@ mod tests { use rope::Point; use unindent::Unindent as _; - let (editor, mut cx) = - init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::SideBySide).await; + let (editor, mut cx) = init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::Split).await; let (buffer1, diff1) = buffer_with_diff("xxx\nyyy", "xxx\nyyy", &mut cx); @@ -3491,8 +3480,7 @@ mod tests { use rope::Point; use unindent::Unindent as _; - let (editor, mut cx) = - init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::SideBySide).await; + let (editor, mut cx) = init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::Split).await; let base_text = " aaa @@ -3574,8 +3562,7 @@ mod tests { use rope::Point; use unindent::Unindent as _; - let (editor, mut cx) = - init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::SideBySide).await; + let (editor, mut cx) = init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::Split).await; let base_text = "aaaa bbbb cccc dddd eeee ffff\n"; @@ -3654,8 +3641,7 @@ mod tests { use rope::Point; use unindent::Unindent as _; - let (editor, mut cx) = - init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::SideBySide).await; + let (editor, mut cx) = init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::Split).await; let base_text = " aaa @@ -3777,8 +3763,7 @@ mod tests { use rope::Point; use unindent::Unindent as _; - let (editor, mut cx) = - init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::SideBySide).await; + let (editor, mut cx) = init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::Split).await; let base_text = ""; let current_text = " @@ -3854,8 +3839,7 @@ mod tests { use rope::Point; use unindent::Unindent as _; - let (editor, mut cx) = - init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::SideBySide).await; + let (editor, mut cx) = init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::Split).await; let base_text = " aaa @@ -3950,7 +3934,7 @@ mod tests { use gpui::size; use rope::Point; - let (editor, mut cx) = init_test(cx, SoftWrap::None, DiffViewStyle::SideBySide).await; + let (editor, mut cx) = init_test(cx, SoftWrap::None, DiffViewStyle::Split).await; let long_line = "x".repeat(200); let mut lines: Vec = (0..50).map(|i| format!("line {i}")).collect(); @@ -4033,8 +4017,7 @@ mod tests { use rope::Point; use unindent::Unindent as _; - let (editor, mut cx) = - init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::SideBySide).await; + let (editor, mut cx) = init_test(cx, SoftWrap::EditorWidth, DiffViewStyle::Split).await; let base_text = " first line @@ -4164,7 +4147,7 @@ mod tests { use rope::Point; use unindent::Unindent as _; - let (editor, mut cx) = init_test(cx, SoftWrap::None, DiffViewStyle::SideBySide).await; + let (editor, mut cx) = init_test(cx, SoftWrap::None, DiffViewStyle::Split).await; let base_text = " bbb @@ -4311,7 +4294,7 @@ mod tests { use rope::Point; use unindent::Unindent as _; - let (editor, mut cx) = init_test(cx, SoftWrap::None, DiffViewStyle::SideBySide).await; + let (editor, mut cx) = init_test(cx, SoftWrap::None, DiffViewStyle::Split).await; let base_text = " bbb @@ -4533,7 +4516,7 @@ mod tests { use rope::Point; use unindent::Unindent as _; - let (editor, mut cx) = init_test(cx, SoftWrap::None, DiffViewStyle::SideBySide).await; + let (editor, mut cx) = init_test(cx, SoftWrap::None, DiffViewStyle::Split).await; let base_text = " bbb @@ -4858,7 +4841,7 @@ mod tests { use rope::Point; use unindent::Unindent as _; - let (editor, mut cx) = init_test(cx, SoftWrap::None, DiffViewStyle::Stacked).await; + let (editor, mut cx) = init_test(cx, SoftWrap::None, DiffViewStyle::Unified).await; let base_text1 = " aaa @@ -5035,7 +5018,7 @@ mod tests { use rope::Point; use unindent::Unindent as _; - let (editor, mut cx) = init_test(cx, SoftWrap::None, DiffViewStyle::SideBySide).await; + let (editor, mut cx) = init_test(cx, SoftWrap::None, DiffViewStyle::Split).await; let base_text = " ddd @@ -5196,7 +5179,7 @@ mod tests { use rope::Point; use unindent::Unindent as _; - let (editor, mut cx) = init_test(cx, SoftWrap::None, DiffViewStyle::SideBySide).await; + let (editor, mut cx) = init_test(cx, SoftWrap::None, DiffViewStyle::Split).await; let base_text = " ddd @@ -5357,7 +5340,7 @@ mod tests { use rope::Point; use unindent::Unindent as _; - let (editor, mut cx) = init_test(cx, SoftWrap::None, DiffViewStyle::SideBySide).await; + let (editor, mut cx) = init_test(cx, SoftWrap::None, DiffViewStyle::Split).await; let base_text = " bbb diff --git a/crates/icons/src/icons.rs b/crates/icons/src/icons.rs index 42a8360f4738e3e7440f22ffc77a19c1588fb4a0..cc416f74fe83ca1f0f966d9b8a453619ada8c2b1 100644 --- a/crates/icons/src/icons.rs +++ b/crates/icons/src/icons.rs @@ -93,7 +93,7 @@ pub enum IconName { DebugStepOver, Diff, DiffSplit, - DiffStacked, + DiffUnified, Disconnected, Download, EditorAtom, diff --git a/crates/search/src/buffer_search.rs b/crates/search/src/buffer_search.rs index 90cc36771eb2df6a08140559516a02c36e1773c8..1d46938d6aa4b4a83b1621a8fffc6e39898cc512 100644 --- a/crates/search/src/buffer_search.rs +++ b/crates/search/src/buffer_search.rs @@ -14,7 +14,7 @@ use any_vec::AnyVec; use collections::HashMap; use editor::{ DisplayPoint, Editor, EditorSettings, MultiBufferOffset, SplitDiffFeatureFlag, - SplittableEditor, ToggleDiffView, + SplittableEditor, ToggleSplitDiff, actions::{Backtab, FoldAll, Tab, ToggleFoldAll, UnfoldAll}, }; use feature_flags::FeatureFlagAppExt as _; @@ -119,13 +119,13 @@ impl Render for BufferSearchBar { h_flex() .gap_1() .child( - IconButton::new("diff-stacked", IconName::DiffStacked) + IconButton::new("diff-unified", IconName::DiffUnified) .shape(IconButtonShape::Square) .toggle_state(!is_split) .tooltip(Tooltip::element(move |_, cx| { v_flex() .gap_1() - .child(Label::new("Stacked")) + .child(Label::new("Unified")) .child( h_flex() .gap_0p5() @@ -151,14 +151,14 @@ impl Render for BufferSearchBar { cx, |settings, _| { settings.editor.diff_view_style = - Some(DiffViewStyle::Stacked); + Some(DiffViewStyle::Unified); }, ); } if is_split { focus_handle.focus(window, cx); window - .dispatch_action(ToggleDiffView.boxed_clone(), cx); + .dispatch_action(ToggleSplitDiff.boxed_clone(), cx); } } }), @@ -170,7 +170,7 @@ impl Render for BufferSearchBar { .tooltip(Tooltip::element(move |_, cx| { v_flex() .gap_1() - .child(Label::new("Side by Side")) + .child(Label::new("Split")) .child( h_flex() .gap_0p5() @@ -195,14 +195,14 @@ impl Render for BufferSearchBar { cx, |settings, _| { settings.editor.diff_view_style = - Some(DiffViewStyle::SideBySide); + Some(DiffViewStyle::Split); }, ); } if !is_split { focus_handle.focus(window, cx); window - .dispatch_action(ToggleDiffView.boxed_clone(), cx); + .dispatch_action(ToggleSplitDiff.boxed_clone(), cx); } } }), diff --git a/crates/settings_content/src/editor.rs b/crates/settings_content/src/editor.rs index 2d3f358782e782833f5e5ff74bf2c7dc676b5455..f07e41e0e523fba4d9c46851ed758d0680156fa1 100644 --- a/crates/settings_content/src/editor.rs +++ b/crates/settings_content/src/editor.rs @@ -224,7 +224,7 @@ pub struct EditorSettingsContent { /// How to display diffs in the editor. /// - /// Default: stacked + /// Default: unified pub diff_view_style: Option, } @@ -786,7 +786,7 @@ pub enum SnippetSortOrder { /// How to display diffs in the editor. /// -/// Default: stacked +/// Default: unified #[derive( Copy, Clone, @@ -805,11 +805,11 @@ pub enum SnippetSortOrder { )] #[serde(rename_all = "snake_case")] pub enum DiffViewStyle { - /// Show diffs in a single stacked view. + /// Show diffs in a single unified view. #[default] - Stacked, - /// Show diffs in a side-by-side split view. - SideBySide, + Unified, + /// Show diffs in a split view. + Split, } /// Default options for buffer and project search items.