Compare commits
52 Commits
drop-image
...
v0.119.19
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
020eadc7a4 | ||
|
|
5f40ce5bbc | ||
|
|
d5d383c589 | ||
|
|
e59d7eb618 | ||
|
|
1981f3973e | ||
|
|
ba15d96ab6 | ||
|
|
323fc8a313 | ||
|
|
a8ad67b233 | ||
|
|
cd099bcc01 | ||
|
|
7ff6c2dd2b | ||
|
|
5b34b775ca | ||
|
|
d59ebac2fa | ||
|
|
4b7ea172d7 | ||
|
|
2a7ccb5758 | ||
|
|
f148211b92 | ||
|
|
ae9178e034 | ||
|
|
09ff2a8353 | ||
|
|
d2d4319e44 | ||
|
|
66e2cf5671 | ||
|
|
528cb97bc5 | ||
|
|
bcf3476155 | ||
|
|
937c7019a0 | ||
|
|
4a95347087 | ||
|
|
9a9840533d | ||
|
|
df96b641d7 | ||
|
|
b0a1e25fbb | ||
|
|
9cb0a428f7 | ||
|
|
6084e22844 | ||
|
|
76ff0f5fff | ||
|
|
ed1c2bd29e | ||
|
|
d1e7ca8762 | ||
|
|
d57dfba2fb | ||
|
|
3da4a78cb1 | ||
|
|
6c34c360f5 | ||
|
|
52eab41b7f | ||
|
|
497c42e941 | ||
|
|
f56f50da10 | ||
|
|
0f17fa8a61 | ||
|
|
f5c2e15593 | ||
|
|
1e4e2afb01 | ||
|
|
0f8c58fc6b | ||
|
|
c63e577cd3 | ||
|
|
26ed5247cc | ||
|
|
88f0dc7118 | ||
|
|
47f24f9ce2 | ||
|
|
6335117966 | ||
|
|
e8d01f40a4 | ||
|
|
6320316e5c | ||
|
|
62315445cd | ||
|
|
a6da6581b9 | ||
|
|
d6cd48ae96 | ||
|
|
c2685051da |
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -9704,7 +9704,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zed"
|
||||
version = "0.120.0"
|
||||
version = "0.119.19"
|
||||
dependencies = [
|
||||
"activity_indicator",
|
||||
"ai",
|
||||
|
||||
@@ -567,7 +567,7 @@ impl EditorElement {
|
||||
cx,
|
||||
);
|
||||
hover_at(editor, Some(point), cx);
|
||||
Self::update_visible_cursor(editor, point, cx);
|
||||
Self::update_visible_cursor(editor, point, position_map, cx);
|
||||
}
|
||||
None => {
|
||||
update_inlay_link_and_hover_points(
|
||||
@@ -592,9 +592,10 @@ impl EditorElement {
|
||||
fn update_visible_cursor(
|
||||
editor: &mut Editor,
|
||||
point: DisplayPoint,
|
||||
position_map: &PositionMap,
|
||||
cx: &mut ViewContext<Editor>,
|
||||
) {
|
||||
let snapshot = editor.snapshot(cx);
|
||||
let snapshot = &position_map.snapshot;
|
||||
let Some(hub) = editor.collaboration_hub() else {
|
||||
return;
|
||||
};
|
||||
|
||||
@@ -3,7 +3,7 @@ use gpui::AppContext;
|
||||
use human_bytes::human_bytes;
|
||||
use serde::Serialize;
|
||||
use std::{env, fmt::Display};
|
||||
use sysinfo::{System, SystemExt};
|
||||
use sysinfo::{RefreshKind, System, SystemExt};
|
||||
use util::channel::ReleaseChannel;
|
||||
|
||||
#[derive(Clone, Debug, Serialize)]
|
||||
@@ -23,7 +23,7 @@ impl SystemSpecs {
|
||||
.map(|v| v.to_string());
|
||||
let release_channel = cx.global::<ReleaseChannel>().display_name();
|
||||
let os_name = cx.app_metadata().os_name;
|
||||
let system = System::new_all();
|
||||
let system = System::new_with_specifics(RefreshKind::new().with_memory());
|
||||
let memory = system.total_memory();
|
||||
let architecture = env::consts::ARCH;
|
||||
let os_version = cx
|
||||
|
||||
@@ -136,25 +136,6 @@ impl Render for () {
|
||||
fn render(&mut self, _cx: &mut ViewContext<Self>) -> impl IntoElement {}
|
||||
}
|
||||
|
||||
/// A quick way to create a [`Render`]able view without having to define a new type.
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
pub struct TestView(Box<dyn FnMut(&mut ViewContext<TestView>) -> AnyElement>);
|
||||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
impl TestView {
|
||||
/// Construct a TestView from a render closure.
|
||||
pub fn new<F: FnMut(&mut ViewContext<TestView>) -> AnyElement + 'static>(f: F) -> Self {
|
||||
Self(Box::new(f))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
impl Render for TestView {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
(self.0)(cx)
|
||||
}
|
||||
}
|
||||
|
||||
/// You can derive [`IntoElement`] on any type that implements this trait.
|
||||
/// It is used to construct reusable `components` out of plain data. Think of
|
||||
/// components as a recipe for a certain pattern of elements. RenderOnce allows
|
||||
|
||||
@@ -534,67 +534,77 @@ impl Platform for MacPlatform {
|
||||
&self,
|
||||
options: PathPromptOptions,
|
||||
) -> oneshot::Receiver<Option<Vec<PathBuf>>> {
|
||||
unsafe {
|
||||
let panel = NSOpenPanel::openPanel(nil);
|
||||
panel.setCanChooseDirectories_(options.directories.to_objc());
|
||||
panel.setCanChooseFiles_(options.files.to_objc());
|
||||
panel.setAllowsMultipleSelection_(options.multiple.to_objc());
|
||||
panel.setResolvesAliases_(false.to_objc());
|
||||
let (done_tx, done_rx) = oneshot::channel();
|
||||
let done_tx = Cell::new(Some(done_tx));
|
||||
let block = ConcreteBlock::new(move |response: NSModalResponse| {
|
||||
let result = if response == NSModalResponse::NSModalResponseOk {
|
||||
let mut result = Vec::new();
|
||||
let urls = panel.URLs();
|
||||
for i in 0..urls.count() {
|
||||
let url = urls.objectAtIndex(i);
|
||||
if url.isFileURL() == YES {
|
||||
if let Ok(path) = ns_url_to_path(url) {
|
||||
result.push(path)
|
||||
let (done_tx, done_rx) = oneshot::channel();
|
||||
self.foreground_executor()
|
||||
.spawn(async move {
|
||||
unsafe {
|
||||
let panel = NSOpenPanel::openPanel(nil);
|
||||
panel.setCanChooseDirectories_(options.directories.to_objc());
|
||||
panel.setCanChooseFiles_(options.files.to_objc());
|
||||
panel.setAllowsMultipleSelection_(options.multiple.to_objc());
|
||||
panel.setResolvesAliases_(false.to_objc());
|
||||
let done_tx = Cell::new(Some(done_tx));
|
||||
let block = ConcreteBlock::new(move |response: NSModalResponse| {
|
||||
let result = if response == NSModalResponse::NSModalResponseOk {
|
||||
let mut result = Vec::new();
|
||||
let urls = panel.URLs();
|
||||
for i in 0..urls.count() {
|
||||
let url = urls.objectAtIndex(i);
|
||||
if url.isFileURL() == YES {
|
||||
if let Ok(path) = ns_url_to_path(url) {
|
||||
result.push(path)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some(result)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
Some(result)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
if let Some(done_tx) = done_tx.take() {
|
||||
let _ = done_tx.send(result);
|
||||
if let Some(done_tx) = done_tx.take() {
|
||||
let _ = done_tx.send(result);
|
||||
}
|
||||
});
|
||||
let block = block.copy();
|
||||
let _: () = msg_send![panel, beginWithCompletionHandler: block];
|
||||
}
|
||||
});
|
||||
let block = block.copy();
|
||||
let _: () = msg_send![panel, beginWithCompletionHandler: block];
|
||||
done_rx
|
||||
}
|
||||
})
|
||||
.detach();
|
||||
done_rx
|
||||
}
|
||||
|
||||
fn prompt_for_new_path(&self, directory: &Path) -> oneshot::Receiver<Option<PathBuf>> {
|
||||
unsafe {
|
||||
let panel = NSSavePanel::savePanel(nil);
|
||||
let path = ns_string(directory.to_string_lossy().as_ref());
|
||||
let url = NSURL::fileURLWithPath_isDirectory_(nil, path, true.to_objc());
|
||||
panel.setDirectoryURL(url);
|
||||
let directory = directory.to_owned();
|
||||
let (done_tx, done_rx) = oneshot::channel();
|
||||
self.foreground_executor()
|
||||
.spawn(async move {
|
||||
unsafe {
|
||||
let panel = NSSavePanel::savePanel(nil);
|
||||
let path = ns_string(directory.to_string_lossy().as_ref());
|
||||
let url = NSURL::fileURLWithPath_isDirectory_(nil, path, true.to_objc());
|
||||
panel.setDirectoryURL(url);
|
||||
|
||||
let (done_tx, done_rx) = oneshot::channel();
|
||||
let done_tx = Cell::new(Some(done_tx));
|
||||
let block = ConcreteBlock::new(move |response: NSModalResponse| {
|
||||
let mut result = None;
|
||||
if response == NSModalResponse::NSModalResponseOk {
|
||||
let url = panel.URL();
|
||||
if url.isFileURL() == YES {
|
||||
result = ns_url_to_path(panel.URL()).ok()
|
||||
}
|
||||
}
|
||||
let done_tx = Cell::new(Some(done_tx));
|
||||
let block = ConcreteBlock::new(move |response: NSModalResponse| {
|
||||
let mut result = None;
|
||||
if response == NSModalResponse::NSModalResponseOk {
|
||||
let url = panel.URL();
|
||||
if url.isFileURL() == YES {
|
||||
result = ns_url_to_path(panel.URL()).ok()
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(done_tx) = done_tx.take() {
|
||||
let _ = done_tx.send(result);
|
||||
if let Some(done_tx) = done_tx.take() {
|
||||
let _ = done_tx.send(result);
|
||||
}
|
||||
});
|
||||
let block = block.copy();
|
||||
let _: () = msg_send![panel, beginWithCompletionHandler: block];
|
||||
}
|
||||
});
|
||||
let block = block.copy();
|
||||
let _: () = msg_send![panel, beginWithCompletionHandler: block];
|
||||
done_rx
|
||||
}
|
||||
})
|
||||
.detach();
|
||||
|
||||
done_rx
|
||||
}
|
||||
|
||||
fn reveal_path(&self, path: &Path) {
|
||||
|
||||
@@ -94,7 +94,6 @@ type AnyObserver = Box<dyn FnMut(&mut WindowContext) -> bool + 'static>;
|
||||
|
||||
type AnyWindowFocusListener = Box<dyn FnMut(&FocusEvent, &mut WindowContext) -> bool + 'static>;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct FocusEvent {
|
||||
previous_focus_path: SmallVec<[FocusId; 8]>,
|
||||
current_focus_path: SmallVec<[FocusId; 8]>,
|
||||
@@ -2022,12 +2021,11 @@ impl<'a, V: 'static> ViewContext<'a, V> {
|
||||
}
|
||||
}
|
||||
|
||||
// Always emit a notify effect, so that handlers fire correctly
|
||||
self.window_cx.app.push_effect(Effect::Notify {
|
||||
emitter: self.view.model.entity_id,
|
||||
});
|
||||
if !self.window.drawing {
|
||||
self.window_cx.window.dirty = true;
|
||||
self.window_cx.app.push_effect(Effect::Notify {
|
||||
emitter: self.view.model.entity_id,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2759,59 +2757,3 @@ pub fn outline(bounds: impl Into<Bounds<Pixels>>, border_color: impl Into<Hsla>)
|
||||
border_color: border_color.into(),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
|
||||
use std::{cell::RefCell, rc::Rc};
|
||||
|
||||
use crate::{
|
||||
self as gpui, div, FocusHandle, InteractiveElement, IntoElement, Render, TestAppContext,
|
||||
ViewContext, VisualContext,
|
||||
};
|
||||
|
||||
#[gpui::test]
|
||||
fn test_notify_on_focus(cx: &mut TestAppContext) {
|
||||
struct TestFocusView {
|
||||
handle: FocusHandle,
|
||||
}
|
||||
|
||||
impl Render for TestFocusView {
|
||||
fn render(&mut self, _cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||
div().id("test").track_focus(&self.handle)
|
||||
}
|
||||
}
|
||||
|
||||
let notify_counter = Rc::new(RefCell::new(0));
|
||||
|
||||
let (notify_producer, cx) = cx.add_window_view(|cx| {
|
||||
cx.activate_window();
|
||||
let handle = cx.focus_handle();
|
||||
|
||||
cx.on_focus(&handle, |_, cx| {
|
||||
cx.notify();
|
||||
})
|
||||
.detach();
|
||||
|
||||
TestFocusView { handle }
|
||||
});
|
||||
|
||||
let focus_handle = cx.update(|cx| notify_producer.read(cx).handle.clone());
|
||||
|
||||
let _notify_consumer = cx.new_view({
|
||||
|cx| {
|
||||
let notify_counter = notify_counter.clone();
|
||||
cx.observe(¬ify_producer, move |_, _, _| {
|
||||
*notify_counter.borrow_mut() += 1;
|
||||
})
|
||||
.detach();
|
||||
}
|
||||
});
|
||||
|
||||
cx.update(|cx| {
|
||||
cx.focus(&focus_handle);
|
||||
});
|
||||
|
||||
assert_eq!(*notify_counter.borrow(), 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
description = "The fast, collaborative code editor."
|
||||
edition = "2021"
|
||||
name = "zed"
|
||||
version = "0.120.0"
|
||||
version = "0.119.19"
|
||||
publish = false
|
||||
license = "GPL-3.0-only"
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
dev
|
||||
stable
|
||||
Reference in New Issue
Block a user