Compare commits

...
Sign in to create a new pull request.

11 commits

Author SHA1 Message Date
Max Brunsfeld
8da6b60bf7 v0.102.2 stable 2023-09-07 13:57:32 -07:00
Max Brunsfeld
59c76fefa8 Make toolbar horizontal padding more consistent (#2944)
* increase horizontal padding of toolbar itself, remove padding that was
added to individual toolbar items like feedback button.
* make feedback info text and breadcrumbs have the same additional
padding as quick action buttons.

Release Notes:

- Fixed some inconsistencies in the layout of toolbars.
2023-09-07 13:50:06 -07:00
Nate Butler
af2bb55fcd Fix cropped search filters (#2932)
Because of the way we set up tools that add rows inside the toolbar it
is complicated to tighten up the spacing inside the toolbar.

This PR just reverts the changes I made previously. We'll need to
properly add rows below the toolbar instead of rendering search inside
of it to have non-equal height tools be able to descend from it.

Release Notes:

- Preview – Fixed an issue where search filters were partially cut off
in the UI.
2023-09-07 13:49:39 -07:00
Joseph T. Lyons
69dbfe78d5 v0.102.x stable 2023-09-06 12:52:35 -04:00
Conrad Irwin
2124c47653 Fix accidental visual selection on scroll (#2927)
Release Notes:

- vim: Fix bug where scrolling vertically would sometimes enter visual
mode
2023-09-04 14:47:32 -04:00
Antonio Scandurra
d55132c1e8 Avoid duplicate entries in inline assistant's prompt history (#2926)
Release Notes:

- Improved the inline assistant's prompt history to avoid including the
same entry multiple times. (preview-only)
2023-09-01 09:21:59 +02:00
Kirill Bulatov
df3dccc23f Use ctrl-: instead of ctrl-shift-: for inlay hints toggling (#2921)
The latter is not possible to press in Zed, since `:` is typed as
`shift-;` with typical US keyboard layouts.

In the end, it's the same buttons you have to press to toggle the inlay
hints, but working this time.

Release Notes:

- N/A
2023-08-31 18:59:47 +03:00
Max Brunsfeld
aff0e9019e zed 0.102.1 2023-08-30 15:11:25 -07:00
Max Brunsfeld
935dcee510 Disable save as prompt for channel notes (#2917) 2023-08-30 15:10:13 -07:00
Max Brunsfeld
f872d2e473 Fix collab panel regressions (#2915)
Release Notes:

- Fixed a bug where collaborators' cursors were rendered with the wrong
color when not following them (preview only).
- Fixed an issue where icons were inconsistent sizes in the
collaboration panel (preview only).
2023-08-30 14:42:31 -07:00
Joseph T. Lyons
2aa94f3052 v0.102.x preview 2023-08-30 13:40:36 -04:00
15 changed files with 110 additions and 92 deletions

2
Cargo.lock generated
View file

@ -9702,7 +9702,7 @@ dependencies = [
[[package]]
name = "zed"
version = "0.102.0"
version = "0.102.2"
dependencies = [
"activity_indicator",
"ai",

View file

@ -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",
}
},
{

View file

@ -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

View file

@ -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 {

View file

@ -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(

View file

@ -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(),

View file

@ -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.

View file

@ -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.),
}
}

View file

@ -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()

View file

@ -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)
)
});
}
}

View file

@ -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]

View file

@ -1 +1 @@
dev
stable

View file

@ -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,

View file

@ -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: {},

View file

@ -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: {