Compare commits

...

4 Commits

Author SHA1 Message Date
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
7 changed files with 62 additions and 29 deletions

2
Cargo.lock generated
View File

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

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

@@ -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.1"
publish = false
license = "GPL-3.0-or-later"
authors = ["Zed Team <hi@zed.dev>"]

View File

@@ -1 +1 @@
dev
preview