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]]
|
||||
name = "zed"
|
||||
version = "0.102.0"
|
||||
version = "0.102.2"
|
||||
dependencies = [
|
||||
"activity_indicator",
|
||||
"ai",
|
||||
|
|
|
@ -522,7 +522,7 @@
|
|||
// TODO: Move this to a dock open action
|
||||
"cmd-shift-c": "collab_panel::ToggleFocus",
|
||||
"cmd-alt-i": "zed::DebugElements",
|
||||
"ctrl-shift-:": "editor::ToggleInlayHints",
|
||||
"ctrl-:": "editor::ToggleInlayHints",
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -513,10 +513,13 @@ impl AssistantPanel {
|
|||
return;
|
||||
};
|
||||
|
||||
self.inline_prompt_history
|
||||
.retain(|prompt| prompt != user_prompt);
|
||||
self.inline_prompt_history.push_back(user_prompt.into());
|
||||
if self.inline_prompt_history.len() > Self::INLINE_PROMPT_HISTORY_MAX_LEN {
|
||||
self.inline_prompt_history.pop_front();
|
||||
}
|
||||
|
||||
let range = pending_assist.range.clone();
|
||||
let snapshot = editor.read(cx).buffer().read(cx).snapshot(cx);
|
||||
let selected_text = snapshot
|
||||
|
|
|
@ -213,7 +213,7 @@ impl Item for ChannelView {
|
|||
}
|
||||
|
||||
fn is_singleton(&self, _cx: &AppContext) -> bool {
|
||||
true
|
||||
false
|
||||
}
|
||||
|
||||
fn navigate(&mut self, data: Box<dyn Any>, cx: &mut ViewContext<Self>) -> bool {
|
||||
|
|
|
@ -1106,23 +1106,17 @@ impl CollabPanel {
|
|||
) -> AnyElement<Self> {
|
||||
enum OpenSharedScreen {}
|
||||
|
||||
let font_cache = cx.font_cache();
|
||||
let host_avatar_height = theme
|
||||
let host_avatar_width = theme
|
||||
.contact_avatar
|
||||
.width
|
||||
.or(theme.contact_avatar.height)
|
||||
.unwrap_or(0.);
|
||||
let row = &theme.project_row.inactive_state().default;
|
||||
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, _>(
|
||||
peer_id.as_u64() as usize,
|
||||
cx,
|
||||
|mouse_state, _| {
|
||||
|mouse_state, cx| {
|
||||
let tree_branch = *tree_branch.in_state(is_selected).style_for(mouse_state);
|
||||
let row = theme
|
||||
.project_row
|
||||
|
@ -1130,49 +1124,20 @@ impl CollabPanel {
|
|||
.style_for(mouse_state);
|
||||
|
||||
Flex::row()
|
||||
.with_child(
|
||||
Stack::new()
|
||||
.with_child(Canvas::new(move |scene, bounds, _, _, _| {
|
||||
let start_x = bounds.min_x() + (bounds.width() / 2.)
|
||||
- (tree_branch.width / 2.);
|
||||
let end_x = bounds.max_x();
|
||||
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(render_tree_branch(
|
||||
tree_branch,
|
||||
&row.name.text,
|
||||
is_last,
|
||||
vec2f(host_avatar_width, theme.row_height),
|
||||
cx.font_cache(),
|
||||
))
|
||||
.with_child(
|
||||
Svg::new("icons/disable_screen_sharing_12.svg")
|
||||
.with_color(row.icon.color)
|
||||
.with_color(theme.channel_hash.color)
|
||||
.constrained()
|
||||
.with_width(row.icon.width)
|
||||
.with_width(theme.channel_hash.width)
|
||||
.aligned()
|
||||
.left()
|
||||
.contained()
|
||||
.with_style(row.icon.container),
|
||||
.left(),
|
||||
)
|
||||
.with_child(
|
||||
Label::new("Screen", row.name.text.clone())
|
||||
|
@ -2553,27 +2518,16 @@ impl View for CollabPanel {
|
|||
.with_child(
|
||||
Flex::column()
|
||||
.with_child(
|
||||
Flex::row()
|
||||
.with_child(
|
||||
ChildView::new(&self.filter_editor, cx)
|
||||
.contained()
|
||||
.with_style(theme.user_query_editor.container)
|
||||
.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(),
|
||||
Flex::row().with_child(
|
||||
ChildView::new(&self.filter_editor, cx)
|
||||
.contained()
|
||||
.with_style(theme.user_query_editor.container)
|
||||
.flex(1.0, true),
|
||||
),
|
||||
)
|
||||
.with_child(List::new(self.list_state.clone()).flex(1., true).into_any())
|
||||
.contained()
|
||||
.with_style(theme.container)
|
||||
.constrained()
|
||||
.with_width(self.size(cx))
|
||||
.into_any(),
|
||||
)
|
||||
.with_children(
|
||||
|
|
|
@ -1559,7 +1559,7 @@ impl Editor {
|
|||
.excerpt_containing(self.selections.newest_anchor().head(), cx)
|
||||
}
|
||||
|
||||
fn style(&self, cx: &AppContext) -> EditorStyle {
|
||||
pub fn style(&self, cx: &AppContext) -> EditorStyle {
|
||||
build_style(
|
||||
settings::get::<ThemeSettings>(cx),
|
||||
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 {
|
||||
mapping.get(&replica_id).copied()
|
||||
} else {
|
||||
None
|
||||
Some(replica_id)
|
||||
};
|
||||
|
||||
// The local selections match the leader's selections.
|
||||
|
|
|
@ -39,7 +39,7 @@ impl ScrollAmount {
|
|||
.visible_line_count()
|
||||
// subtract one to leave an anchor line
|
||||
// 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.),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,14 +42,14 @@ impl View for FeedbackInfoText {
|
|||
)
|
||||
.with_child(
|
||||
MouseEventHandler::new::<OpenZedCommunityRepo, _>(0, cx, |state, _| {
|
||||
let contained_text = if state.hovered() {
|
||||
let style = if state.hovered() {
|
||||
&theme.feedback.link_text_hover
|
||||
} else {
|
||||
&theme.feedback.link_text_default
|
||||
};
|
||||
|
||||
Label::new("community repo", contained_text.text.clone())
|
||||
Label::new("community repo", style.text.clone())
|
||||
.contained()
|
||||
.with_style(style.container)
|
||||
.aligned()
|
||||
.left()
|
||||
.clipped()
|
||||
|
@ -64,6 +64,8 @@ impl View for FeedbackInfoText {
|
|||
.with_soft_wrap(false)
|
||||
.aligned(),
|
||||
)
|
||||
.contained()
|
||||
.with_style(theme.feedback.info_text_default.container)
|
||||
.aligned()
|
||||
.left()
|
||||
.clipped()
|
||||
|
|
|
@ -67,7 +67,8 @@ fn scroll_editor(editor: &mut Editor, amount: &ScrollAmount, cx: &mut ViewContex
|
|||
let top_anchor = editor.scroll_manager.anchor().anchor;
|
||||
|
||||
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 min_row = top.row() + VERTICAL_SCROLL_MARGIN as u32;
|
||||
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 {
|
||||
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 gpui::geometry::vector::vec2f;
|
||||
use indoc::indoc;
|
||||
use language::Point;
|
||||
|
||||
#[gpui::test]
|
||||
async fn test_scroll(cx: &mut gpui::TestAppContext) {
|
||||
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| {
|
||||
assert_eq!(editor.snapshot(cx).scroll_position(), vec2f(0., 0.))
|
||||
|
@ -112,5 +140,33 @@ mod test {
|
|||
cx.update_editor(|editor, cx| {
|
||||
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."
|
||||
edition = "2021"
|
||||
name = "zed"
|
||||
version = "0.102.0"
|
||||
version = "0.102.2"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
|
|
|
@ -1 +1 @@
|
|||
dev
|
||||
stable
|
|
@ -12,9 +12,6 @@ export default function feedback(): any {
|
|||
background: background(theme.highest, "on"),
|
||||
corner_radius: 6,
|
||||
border: border(theme.highest, "on"),
|
||||
margin: {
|
||||
right: 4,
|
||||
},
|
||||
padding: {
|
||||
bottom: 2,
|
||||
left: 10,
|
||||
|
@ -41,9 +38,15 @@ export default function feedback(): any {
|
|||
},
|
||||
}),
|
||||
button_margin: 8,
|
||||
info_text_default: text(theme.highest, "sans", "default", {
|
||||
size: "xs",
|
||||
}),
|
||||
info_text_default: {
|
||||
padding: {
|
||||
left: 4,
|
||||
right: 4,
|
||||
},
|
||||
...text(theme.highest, "sans", "default", {
|
||||
size: "xs",
|
||||
})
|
||||
},
|
||||
link_text_default: text(theme.highest, "sans", "default", {
|
||||
size: "xs",
|
||||
underline: true,
|
||||
|
|
|
@ -48,7 +48,7 @@ export default function search(): any {
|
|||
}
|
||||
|
||||
return {
|
||||
padding: { top: 0, bottom: 0 },
|
||||
padding: { top: 4, bottom: 4 },
|
||||
|
||||
option_button: toggleable({
|
||||
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,
|
||||
option_button_height: 22,
|
||||
modes_container: {},
|
||||
|
|
|
@ -7,8 +7,8 @@ export const toolbar = () => {
|
|||
const theme = useTheme()
|
||||
|
||||
return {
|
||||
height: 32,
|
||||
padding: { left: 4, right: 4, top: 4, bottom: 4 },
|
||||
height: 42,
|
||||
padding: { left: 8, right: 8 },
|
||||
background: background(theme.highest),
|
||||
border: border(theme.highest, { bottom: true }),
|
||||
item_spacing: 4,
|
||||
|
@ -23,9 +23,9 @@ export const toolbar = () => {
|
|||
...text(theme.highest, "sans", "variant"),
|
||||
corner_radius: 6,
|
||||
padding: {
|
||||
left: 6,
|
||||
right: 6,
|
||||
},
|
||||
left: 4,
|
||||
right: 4,
|
||||
}
|
||||
},
|
||||
state: {
|
||||
hovered: {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue