Compare commits
11 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
8da6b60bf7 | ||
![]() |
59c76fefa8 | ||
![]() |
af2bb55fcd | ||
![]() |
69dbfe78d5 | ||
![]() |
2124c47653 | ||
![]() |
d55132c1e8 | ||
![]() |
df3dccc23f | ||
![]() |
aff0e9019e | ||
![]() |
935dcee510 | ||
![]() |
f872d2e473 | ||
![]() |
2aa94f3052 |
15 changed files with 110 additions and 92 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -9702,7 +9702,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zed"
|
name = "zed"
|
||||||
version = "0.102.0"
|
version = "0.102.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"activity_indicator",
|
"activity_indicator",
|
||||||
"ai",
|
"ai",
|
||||||
|
|
|
@ -522,7 +522,7 @@
|
||||||
// TODO: Move this to a dock open action
|
// TODO: Move this to a dock open action
|
||||||
"cmd-shift-c": "collab_panel::ToggleFocus",
|
"cmd-shift-c": "collab_panel::ToggleFocus",
|
||||||
"cmd-alt-i": "zed::DebugElements",
|
"cmd-alt-i": "zed::DebugElements",
|
||||||
"ctrl-shift-:": "editor::ToggleInlayHints",
|
"ctrl-:": "editor::ToggleInlayHints",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -513,10 +513,13 @@ impl AssistantPanel {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.inline_prompt_history
|
||||||
|
.retain(|prompt| prompt != user_prompt);
|
||||||
self.inline_prompt_history.push_back(user_prompt.into());
|
self.inline_prompt_history.push_back(user_prompt.into());
|
||||||
if self.inline_prompt_history.len() > Self::INLINE_PROMPT_HISTORY_MAX_LEN {
|
if self.inline_prompt_history.len() > Self::INLINE_PROMPT_HISTORY_MAX_LEN {
|
||||||
self.inline_prompt_history.pop_front();
|
self.inline_prompt_history.pop_front();
|
||||||
}
|
}
|
||||||
|
|
||||||
let range = pending_assist.range.clone();
|
let range = pending_assist.range.clone();
|
||||||
let snapshot = editor.read(cx).buffer().read(cx).snapshot(cx);
|
let snapshot = editor.read(cx).buffer().read(cx).snapshot(cx);
|
||||||
let selected_text = snapshot
|
let selected_text = snapshot
|
||||||
|
|
|
@ -213,7 +213,7 @@ impl Item for ChannelView {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_singleton(&self, _cx: &AppContext) -> bool {
|
fn is_singleton(&self, _cx: &AppContext) -> bool {
|
||||||
true
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn navigate(&mut self, data: Box<dyn Any>, cx: &mut ViewContext<Self>) -> bool {
|
fn navigate(&mut self, data: Box<dyn Any>, cx: &mut ViewContext<Self>) -> bool {
|
||||||
|
|
|
@ -1106,23 +1106,17 @@ impl CollabPanel {
|
||||||
) -> AnyElement<Self> {
|
) -> AnyElement<Self> {
|
||||||
enum OpenSharedScreen {}
|
enum OpenSharedScreen {}
|
||||||
|
|
||||||
let font_cache = cx.font_cache();
|
let host_avatar_width = theme
|
||||||
let host_avatar_height = theme
|
|
||||||
.contact_avatar
|
.contact_avatar
|
||||||
.width
|
.width
|
||||||
.or(theme.contact_avatar.height)
|
.or(theme.contact_avatar.height)
|
||||||
.unwrap_or(0.);
|
.unwrap_or(0.);
|
||||||
let row = &theme.project_row.inactive_state().default;
|
|
||||||
let tree_branch = theme.tree_branch;
|
let tree_branch = theme.tree_branch;
|
||||||
let line_height = row.name.text.line_height(font_cache);
|
|
||||||
let cap_height = row.name.text.cap_height(font_cache);
|
|
||||||
let baseline_offset =
|
|
||||||
row.name.text.baseline_offset(font_cache) + (theme.row_height - line_height) / 2.;
|
|
||||||
|
|
||||||
MouseEventHandler::new::<OpenSharedScreen, _>(
|
MouseEventHandler::new::<OpenSharedScreen, _>(
|
||||||
peer_id.as_u64() as usize,
|
peer_id.as_u64() as usize,
|
||||||
cx,
|
cx,
|
||||||
|mouse_state, _| {
|
|mouse_state, cx| {
|
||||||
let tree_branch = *tree_branch.in_state(is_selected).style_for(mouse_state);
|
let tree_branch = *tree_branch.in_state(is_selected).style_for(mouse_state);
|
||||||
let row = theme
|
let row = theme
|
||||||
.project_row
|
.project_row
|
||||||
|
@ -1130,49 +1124,20 @@ impl CollabPanel {
|
||||||
.style_for(mouse_state);
|
.style_for(mouse_state);
|
||||||
|
|
||||||
Flex::row()
|
Flex::row()
|
||||||
.with_child(
|
.with_child(render_tree_branch(
|
||||||
Stack::new()
|
tree_branch,
|
||||||
.with_child(Canvas::new(move |scene, bounds, _, _, _| {
|
&row.name.text,
|
||||||
let start_x = bounds.min_x() + (bounds.width() / 2.)
|
is_last,
|
||||||
- (tree_branch.width / 2.);
|
vec2f(host_avatar_width, theme.row_height),
|
||||||
let end_x = bounds.max_x();
|
cx.font_cache(),
|
||||||
let start_y = bounds.min_y();
|
))
|
||||||
let end_y = bounds.min_y() + baseline_offset - (cap_height / 2.);
|
|
||||||
|
|
||||||
scene.push_quad(gpui::Quad {
|
|
||||||
bounds: RectF::from_points(
|
|
||||||
vec2f(start_x, start_y),
|
|
||||||
vec2f(
|
|
||||||
start_x + tree_branch.width,
|
|
||||||
if is_last { end_y } else { bounds.max_y() },
|
|
||||||
),
|
|
||||||
),
|
|
||||||
background: Some(tree_branch.color),
|
|
||||||
border: gpui::Border::default(),
|
|
||||||
corner_radii: (0.).into(),
|
|
||||||
});
|
|
||||||
scene.push_quad(gpui::Quad {
|
|
||||||
bounds: RectF::from_points(
|
|
||||||
vec2f(start_x, end_y),
|
|
||||||
vec2f(end_x, end_y + tree_branch.width),
|
|
||||||
),
|
|
||||||
background: Some(tree_branch.color),
|
|
||||||
border: gpui::Border::default(),
|
|
||||||
corner_radii: (0.).into(),
|
|
||||||
});
|
|
||||||
}))
|
|
||||||
.constrained()
|
|
||||||
.with_width(host_avatar_height),
|
|
||||||
)
|
|
||||||
.with_child(
|
.with_child(
|
||||||
Svg::new("icons/disable_screen_sharing_12.svg")
|
Svg::new("icons/disable_screen_sharing_12.svg")
|
||||||
.with_color(row.icon.color)
|
.with_color(theme.channel_hash.color)
|
||||||
.constrained()
|
.constrained()
|
||||||
.with_width(row.icon.width)
|
.with_width(theme.channel_hash.width)
|
||||||
.aligned()
|
.aligned()
|
||||||
.left()
|
.left(),
|
||||||
.contained()
|
|
||||||
.with_style(row.icon.container),
|
|
||||||
)
|
)
|
||||||
.with_child(
|
.with_child(
|
||||||
Label::new("Screen", row.name.text.clone())
|
Label::new("Screen", row.name.text.clone())
|
||||||
|
@ -2553,27 +2518,16 @@ impl View for CollabPanel {
|
||||||
.with_child(
|
.with_child(
|
||||||
Flex::column()
|
Flex::column()
|
||||||
.with_child(
|
.with_child(
|
||||||
Flex::row()
|
Flex::row().with_child(
|
||||||
.with_child(
|
ChildView::new(&self.filter_editor, cx)
|
||||||
ChildView::new(&self.filter_editor, cx)
|
.contained()
|
||||||
.contained()
|
.with_style(theme.user_query_editor.container)
|
||||||
.with_style(theme.user_query_editor.container)
|
.flex(1.0, true),
|
||||||
.flex(1.0, true),
|
),
|
||||||
)
|
|
||||||
.constrained()
|
|
||||||
.with_width(self.size(cx)),
|
|
||||||
)
|
|
||||||
.with_child(
|
|
||||||
List::new(self.list_state.clone())
|
|
||||||
.constrained()
|
|
||||||
.with_width(self.size(cx))
|
|
||||||
.flex(1., true)
|
|
||||||
.into_any(),
|
|
||||||
)
|
)
|
||||||
|
.with_child(List::new(self.list_state.clone()).flex(1., true).into_any())
|
||||||
.contained()
|
.contained()
|
||||||
.with_style(theme.container)
|
.with_style(theme.container)
|
||||||
.constrained()
|
|
||||||
.with_width(self.size(cx))
|
|
||||||
.into_any(),
|
.into_any(),
|
||||||
)
|
)
|
||||||
.with_children(
|
.with_children(
|
||||||
|
|
|
@ -1559,7 +1559,7 @@ impl Editor {
|
||||||
.excerpt_containing(self.selections.newest_anchor().head(), cx)
|
.excerpt_containing(self.selections.newest_anchor().head(), cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn style(&self, cx: &AppContext) -> EditorStyle {
|
pub fn style(&self, cx: &AppContext) -> EditorStyle {
|
||||||
build_style(
|
build_style(
|
||||||
settings::get::<ThemeSettings>(cx),
|
settings::get::<ThemeSettings>(cx),
|
||||||
self.get_field_editor_theme.as_deref(),
|
self.get_field_editor_theme.as_deref(),
|
||||||
|
|
|
@ -2251,7 +2251,7 @@ impl Element<Editor> for EditorElement {
|
||||||
let replica_id = if let Some(mapping) = &editor.replica_id_mapping {
|
let replica_id = if let Some(mapping) = &editor.replica_id_mapping {
|
||||||
mapping.get(&replica_id).copied()
|
mapping.get(&replica_id).copied()
|
||||||
} else {
|
} else {
|
||||||
None
|
Some(replica_id)
|
||||||
};
|
};
|
||||||
|
|
||||||
// The local selections match the leader's selections.
|
// The local selections match the leader's selections.
|
||||||
|
|
|
@ -39,7 +39,7 @@ impl ScrollAmount {
|
||||||
.visible_line_count()
|
.visible_line_count()
|
||||||
// subtract one to leave an anchor line
|
// subtract one to leave an anchor line
|
||||||
// round towards zero (so page-up and page-down are symmetric)
|
// round towards zero (so page-up and page-down are symmetric)
|
||||||
.map(|l| ((l - 1.) * count).trunc())
|
.map(|l| (l * count).trunc() - count.signum())
|
||||||
.unwrap_or(0.),
|
.unwrap_or(0.),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,14 +42,14 @@ impl View for FeedbackInfoText {
|
||||||
)
|
)
|
||||||
.with_child(
|
.with_child(
|
||||||
MouseEventHandler::new::<OpenZedCommunityRepo, _>(0, cx, |state, _| {
|
MouseEventHandler::new::<OpenZedCommunityRepo, _>(0, cx, |state, _| {
|
||||||
let contained_text = if state.hovered() {
|
let style = if state.hovered() {
|
||||||
&theme.feedback.link_text_hover
|
&theme.feedback.link_text_hover
|
||||||
} else {
|
} else {
|
||||||
&theme.feedback.link_text_default
|
&theme.feedback.link_text_default
|
||||||
};
|
};
|
||||||
|
Label::new("community repo", style.text.clone())
|
||||||
Label::new("community repo", contained_text.text.clone())
|
|
||||||
.contained()
|
.contained()
|
||||||
|
.with_style(style.container)
|
||||||
.aligned()
|
.aligned()
|
||||||
.left()
|
.left()
|
||||||
.clipped()
|
.clipped()
|
||||||
|
@ -64,6 +64,8 @@ impl View for FeedbackInfoText {
|
||||||
.with_soft_wrap(false)
|
.with_soft_wrap(false)
|
||||||
.aligned(),
|
.aligned(),
|
||||||
)
|
)
|
||||||
|
.contained()
|
||||||
|
.with_style(theme.feedback.info_text_default.container)
|
||||||
.aligned()
|
.aligned()
|
||||||
.left()
|
.left()
|
||||||
.clipped()
|
.clipped()
|
||||||
|
|
|
@ -67,7 +67,8 @@ fn scroll_editor(editor: &mut Editor, amount: &ScrollAmount, cx: &mut ViewContex
|
||||||
let top_anchor = editor.scroll_manager.anchor().anchor;
|
let top_anchor = editor.scroll_manager.anchor().anchor;
|
||||||
|
|
||||||
editor.change_selections(None, cx, |s| {
|
editor.change_selections(None, cx, |s| {
|
||||||
s.move_heads_with(|map, head, goal| {
|
s.move_with(|map, selection| {
|
||||||
|
let head = selection.head();
|
||||||
let top = top_anchor.to_display_point(map);
|
let top = top_anchor.to_display_point(map);
|
||||||
let min_row = top.row() + VERTICAL_SCROLL_MARGIN as u32;
|
let min_row = top.row() + VERTICAL_SCROLL_MARGIN as u32;
|
||||||
let max_row = top.row() + visible_rows - VERTICAL_SCROLL_MARGIN as u32 - 1;
|
let max_row = top.row() + visible_rows - VERTICAL_SCROLL_MARGIN as u32 - 1;
|
||||||
|
@ -79,7 +80,11 @@ fn scroll_editor(editor: &mut Editor, amount: &ScrollAmount, cx: &mut ViewContex
|
||||||
} else {
|
} else {
|
||||||
head
|
head
|
||||||
};
|
};
|
||||||
(new_head, goal)
|
if selection.is_empty() {
|
||||||
|
selection.collapse_to(new_head, selection.goal)
|
||||||
|
} else {
|
||||||
|
selection.set_head(new_head, selection.goal)
|
||||||
|
};
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -90,12 +95,35 @@ mod test {
|
||||||
use crate::{state::Mode, test::VimTestContext};
|
use crate::{state::Mode, test::VimTestContext};
|
||||||
use gpui::geometry::vector::vec2f;
|
use gpui::geometry::vector::vec2f;
|
||||||
use indoc::indoc;
|
use indoc::indoc;
|
||||||
|
use language::Point;
|
||||||
|
|
||||||
#[gpui::test]
|
#[gpui::test]
|
||||||
async fn test_scroll(cx: &mut gpui::TestAppContext) {
|
async fn test_scroll(cx: &mut gpui::TestAppContext) {
|
||||||
let mut cx = VimTestContext::new(cx, true).await;
|
let mut cx = VimTestContext::new(cx, true).await;
|
||||||
|
|
||||||
cx.set_state(indoc! {"ˇa\nb\nc\nd\ne\n"}, Mode::Normal);
|
let window = cx.window;
|
||||||
|
let line_height =
|
||||||
|
cx.editor(|editor, cx| editor.style(cx).text.line_height(cx.font_cache()));
|
||||||
|
window.simulate_resize(vec2f(1000., 8.0 * line_height - 1.0), &mut cx);
|
||||||
|
|
||||||
|
cx.set_state(
|
||||||
|
indoc!(
|
||||||
|
"ˇone
|
||||||
|
two
|
||||||
|
three
|
||||||
|
four
|
||||||
|
five
|
||||||
|
six
|
||||||
|
seven
|
||||||
|
eight
|
||||||
|
nine
|
||||||
|
ten
|
||||||
|
eleven
|
||||||
|
twelve
|
||||||
|
"
|
||||||
|
),
|
||||||
|
Mode::Normal,
|
||||||
|
);
|
||||||
|
|
||||||
cx.update_editor(|editor, cx| {
|
cx.update_editor(|editor, cx| {
|
||||||
assert_eq!(editor.snapshot(cx).scroll_position(), vec2f(0., 0.))
|
assert_eq!(editor.snapshot(cx).scroll_position(), vec2f(0., 0.))
|
||||||
|
@ -112,5 +140,33 @@ mod test {
|
||||||
cx.update_editor(|editor, cx| {
|
cx.update_editor(|editor, cx| {
|
||||||
assert_eq!(editor.snapshot(cx).scroll_position(), vec2f(0., 2.))
|
assert_eq!(editor.snapshot(cx).scroll_position(), vec2f(0., 2.))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// does not select in normal mode
|
||||||
|
cx.simulate_keystrokes(["g", "g"]);
|
||||||
|
cx.update_editor(|editor, cx| {
|
||||||
|
assert_eq!(editor.snapshot(cx).scroll_position(), vec2f(0., 0.))
|
||||||
|
});
|
||||||
|
cx.simulate_keystrokes(["ctrl-d"]);
|
||||||
|
cx.update_editor(|editor, cx| {
|
||||||
|
assert_eq!(editor.snapshot(cx).scroll_position(), vec2f(0., 2.0));
|
||||||
|
assert_eq!(
|
||||||
|
editor.selections.newest(cx).range(),
|
||||||
|
Point::new(5, 0)..Point::new(5, 0)
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
|
// does select in visual mode
|
||||||
|
cx.simulate_keystrokes(["g", "g"]);
|
||||||
|
cx.update_editor(|editor, cx| {
|
||||||
|
assert_eq!(editor.snapshot(cx).scroll_position(), vec2f(0., 0.))
|
||||||
|
});
|
||||||
|
cx.simulate_keystrokes(["v", "ctrl-d"]);
|
||||||
|
cx.update_editor(|editor, cx| {
|
||||||
|
assert_eq!(editor.snapshot(cx).scroll_position(), vec2f(0., 2.0));
|
||||||
|
assert_eq!(
|
||||||
|
editor.selections.newest(cx).range(),
|
||||||
|
Point::new(0, 0)..Point::new(5, 1)
|
||||||
|
)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ authors = ["Nathan Sobo <nathansobo@gmail.com>"]
|
||||||
description = "The fast, collaborative code editor."
|
description = "The fast, collaborative code editor."
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
name = "zed"
|
name = "zed"
|
||||||
version = "0.102.0"
|
version = "0.102.2"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
dev
|
stable
|
|
@ -12,9 +12,6 @@ export default function feedback(): any {
|
||||||
background: background(theme.highest, "on"),
|
background: background(theme.highest, "on"),
|
||||||
corner_radius: 6,
|
corner_radius: 6,
|
||||||
border: border(theme.highest, "on"),
|
border: border(theme.highest, "on"),
|
||||||
margin: {
|
|
||||||
right: 4,
|
|
||||||
},
|
|
||||||
padding: {
|
padding: {
|
||||||
bottom: 2,
|
bottom: 2,
|
||||||
left: 10,
|
left: 10,
|
||||||
|
@ -41,9 +38,15 @@ export default function feedback(): any {
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
button_margin: 8,
|
button_margin: 8,
|
||||||
info_text_default: text(theme.highest, "sans", "default", {
|
info_text_default: {
|
||||||
size: "xs",
|
padding: {
|
||||||
}),
|
left: 4,
|
||||||
|
right: 4,
|
||||||
|
},
|
||||||
|
...text(theme.highest, "sans", "default", {
|
||||||
|
size: "xs",
|
||||||
|
})
|
||||||
|
},
|
||||||
link_text_default: text(theme.highest, "sans", "default", {
|
link_text_default: text(theme.highest, "sans", "default", {
|
||||||
size: "xs",
|
size: "xs",
|
||||||
underline: true,
|
underline: true,
|
||||||
|
|
|
@ -48,7 +48,7 @@ export default function search(): any {
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
padding: { top: 0, bottom: 0 },
|
padding: { top: 4, bottom: 4 },
|
||||||
|
|
||||||
option_button: toggleable({
|
option_button: toggleable({
|
||||||
base: interactive({
|
base: interactive({
|
||||||
|
@ -394,7 +394,7 @@ export default function search(): any {
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
search_bar_row_height: 32,
|
search_bar_row_height: 34,
|
||||||
search_row_spacing: 8,
|
search_row_spacing: 8,
|
||||||
option_button_height: 22,
|
option_button_height: 22,
|
||||||
modes_container: {},
|
modes_container: {},
|
||||||
|
|
|
@ -7,8 +7,8 @@ export const toolbar = () => {
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
height: 32,
|
height: 42,
|
||||||
padding: { left: 4, right: 4, top: 4, bottom: 4 },
|
padding: { left: 8, right: 8 },
|
||||||
background: background(theme.highest),
|
background: background(theme.highest),
|
||||||
border: border(theme.highest, { bottom: true }),
|
border: border(theme.highest, { bottom: true }),
|
||||||
item_spacing: 4,
|
item_spacing: 4,
|
||||||
|
@ -23,9 +23,9 @@ export const toolbar = () => {
|
||||||
...text(theme.highest, "sans", "variant"),
|
...text(theme.highest, "sans", "variant"),
|
||||||
corner_radius: 6,
|
corner_radius: 6,
|
||||||
padding: {
|
padding: {
|
||||||
left: 6,
|
left: 4,
|
||||||
right: 6,
|
right: 4,
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
state: {
|
state: {
|
||||||
hovered: {
|
hovered: {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue