Compare commits

...

7 Commits

Author SHA1 Message Date
Joseph T Lyons
eb91b716c8 v0.147.x stable 2024-08-07 10:59:06 -04:00
Antonio Scandurra
97a9fcaa03 zed 0.147.2 2024-08-02 08:25:54 +02:00
gcp-cherry-pick-bot[bot]
73714cbb8e Fix inline assist deletion blocks (cherry-pick #15651) (#15654)
Cherry-picked Fix inline assist deletion blocks (#15651)

After the changes in #15536, block decorations need to be given an
explicit height if their content doesn't consume height on its own. We
missed that inline transformation deletion decorations didn't do this,
creating weird results. This fixes the issue and prevents block
decorations from ever having a zero height. That helps avoid major
weirdness, but this still a bit of a gotcha.

We need to back port this to Preview Channel (0.147.x)

Release Notes:

- N/A

---------

Co-authored-by: Antonio <antonio@zed.dev>

Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Antonio <antonio@zed.dev>
2024-08-02 08:22:59 +02:00
Zed Bot
202dbc225f Bump to 0.147.1 for @SomeoneToIgnore 2024-08-01 09:30:27 -07:00
Piotr Osiewicz
7c2a55dd0e assistant: Report all worktree entries in /file completions (#15617)
We were reporting file count as worktree entry count, which led to us
missing some of the entries in /file command completion.

/cc @bennetbo

The other components that used `PathMatchCandidateSet` are
`/diagnostics` and file finder. File finder is unaffected, as it used
`Candidates::Files` - thus previously reported count was correct for it;
`/diagnostics` were using `::Entries` as well, so it could miss entries
just like `/files`.

Release Notes:

- Fixed /file and /diagnostics slash commands omitting entries in it's
completions menu.
2024-08-01 16:12:09 +02:00
Kirill Bulatov
78e359a079 Properly calculate y offsets for multi buffer context menus (#15594)
Follow-up of https://github.com/zed-industries/zed/pull/14727

Release Notes:

- Fixed multi buffer context menus not showing properly

Co-authored-by: Max Brunsfeld <max@zed.dev>
2024-08-01 12:55:00 +03:00
Joseph T Lyons
38a083c711 v0.147.x preview 2024-07-31 12:17:45 -04:00
9 changed files with 64 additions and 30 deletions

2
Cargo.lock generated
View File

@@ -13710,7 +13710,7 @@ dependencies = [
[[package]]
name = "zed"
version = "0.147.0"
version = "0.147.2"
dependencies = [
"activity_indicator",
"anyhow",

View File

@@ -1014,6 +1014,7 @@ impl InlineAssistant {
div()
.bg(cx.theme().status().deleted_background)
.size_full()
.h(height as f32 * cx.line_height())
.pl(cx.gutter_dimensions.full_width())
.child(deleted_lines_editor.clone())
.into_any_element()

View File

@@ -11800,24 +11800,8 @@ impl Editor {
editor_snapshot: &EditorSnapshot,
cx: &mut ViewContext<Self>,
) -> Option<gpui::Point<Pixels>> {
let text_layout_details = self.text_layout_details(cx);
let line_height = text_layout_details
.editor_style
.text
.line_height_in_pixels(cx.rem_size());
let source_point = source.to_display_point(editor_snapshot);
let first_visible_line = text_layout_details
.scroll_anchor
.anchor
.to_display_point(editor_snapshot);
if first_visible_line > source_point {
return None;
}
let source_x = editor_snapshot.x_for_display_point(source_point, &text_layout_details);
let source_y = line_height
* ((source_point.row() - first_visible_line.row()).0 as f32
- text_layout_details.scroll_anchor.offset.y);
Some(gpui::Point::new(source_x, source_y))
self.display_to_pixel_point(source_point, editor_snapshot, cx)
}
pub fn display_to_pixel_point(
@@ -11828,15 +11812,16 @@ impl Editor {
) -> Option<gpui::Point<Pixels>> {
let line_height = self.style()?.text.line_height_in_pixels(cx.rem_size());
let text_layout_details = self.text_layout_details(cx);
let first_visible_line = text_layout_details
let scroll_top = text_layout_details
.scroll_anchor
.anchor
.to_display_point(editor_snapshot);
if first_visible_line > source {
.scroll_position(editor_snapshot)
.y;
if source.row().as_f32() < scroll_top.floor() {
return None;
}
let source_x = editor_snapshot.x_for_display_point(source, &text_layout_details);
let source_y = line_height * (source.row() - first_visible_line.row()).0 as f32;
let source_y = line_height * (source.row().as_f32() - scroll_top);
Some(gpui::Point::new(source_x, source_y))
}

View File

@@ -2373,7 +2373,7 @@ impl EditorElement {
};
if let BlockId::Custom(custom_block_id) = block_id {
let element_height_in_lines = (final_size.height / line_height).ceil() as u32;
let element_height_in_lines = ((final_size.height / line_height).ceil() as u32).max(1);
if element_height_in_lines != block.height() {
resized_blocks.insert(custom_block_id, element_height_in_lines);
}

View File

@@ -10,6 +10,7 @@ use gpui::prelude::FluentBuilder;
use gpui::{DismissEvent, Pixels, Point, Subscription, View, ViewContext};
use workspace::OpenInTerminal;
#[derive(Debug)]
pub enum MenuPosition {
/// When the editor is scrolled, the context menu stays on the exact
/// same position on the screen, never disappearing.
@@ -29,6 +30,15 @@ pub struct MouseContextMenu {
_subscription: Subscription,
}
impl std::fmt::Debug for MouseContextMenu {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("MouseContextMenu")
.field("position", &self.position)
.field("context_menu", &self.context_menu)
.finish()
}
}
impl MouseContextMenu {
pub(crate) fn pinned_to_editor(
editor: &mut Editor,

View File

@@ -10917,10 +10917,30 @@ impl<'a> fuzzy::PathMatchCandidateSet<'a> for PathMatchCandidateSet {
}
fn len(&self) -> usize {
if self.include_ignored {
self.snapshot.file_count()
} else {
self.snapshot.visible_file_count()
match self.candidates {
Candidates::Files => {
if self.include_ignored {
self.snapshot.file_count()
} else {
self.snapshot.visible_file_count()
}
}
Candidates::Directories => {
if self.include_ignored {
self.snapshot.dir_count()
} else {
self.snapshot.visible_dir_count()
}
}
Candidates::Entries => {
if self.include_ignored {
self.snapshot.entry_count()
} else {
self.snapshot.visible_entry_count()
}
}
}
}

View File

@@ -2118,6 +2118,24 @@ impl Snapshot {
Ok(())
}
pub fn entry_count(&self) -> usize {
self.entries_by_path.summary().count
}
pub fn visible_entry_count(&self) -> usize {
self.entries_by_path.summary().non_ignored_count
}
pub fn dir_count(&self) -> usize {
let summary = self.entries_by_path.summary();
summary.count - summary.file_count
}
pub fn visible_dir_count(&self) -> usize {
let summary = self.entries_by_path.summary();
summary.non_ignored_count - summary.non_ignored_file_count
}
pub fn file_count(&self) -> usize {
self.entries_by_path.summary().file_count
}

View File

@@ -2,7 +2,7 @@
description = "The fast, collaborative code editor."
edition = "2021"
name = "zed"
version = "0.147.0"
version = "0.147.2"
publish = false
license = "GPL-3.0-or-later"
authors = ["Zed Team <hi@zed.dev>"]

View File

@@ -1 +1 @@
dev
stable