Commit Graph

1723 Commits

Author SHA1 Message Date
Dzmitry Malyshau
d6bbcf503b blade: enforce alignment in the belt 2024-02-04 00:09:32 -08:00
Dzmitry Malyshau
c5ff46e14f blade: fix shadow vertex bounds 2024-02-03 23:51:37 -08:00
Dzmitry Malyshau
cf71fe8bf1 fix MacOS build, switch external RWH to 0.6
leaving blade-internal RWH as 0.5 until this is fixed:
https://github.com/ash-rs/ash/issues/864
2024-02-03 23:50:44 -08:00
Dzmitry Malyshau
d0a0ce1885 blade: mono/poly chrome sprite rendering 2024-02-03 21:30:47 -08:00
Antonio Scandurra
ae2c23bd8e
Reintroduce ProMotion support (#7347)
This re-introduces the changes of #7305 but this time we create a
display link using the `NSScreen` associated with the window. We're
hoping we'll get these frame requests more reliably, and this seems
supported by the fact that awakening my laptop restores the frame
requests.

Release Notes:

- See #7305.

Co-authored-by: Nathan <nathan@zed.dev>
2024-02-03 16:33:08 -07:00
Dzmitry Malyshau
59642bf29a blade: point to master, remove the override 2024-02-03 14:13:36 -08:00
Kirill Bulatov
c9a53b63a7
Fix the compilation error (#7328)
Follow-up of https://github.com/zed-industries/zed/pull/7326

Release Notes:

- N/A
2024-02-03 18:52:03 +02:00
Kirill Bulatov
1ab0af2fa3
Revert the commit that broke Zed display capabilities (#7326) 2024-02-03 18:32:56 +02:00
Antonio Scandurra
54aecd21ec
Remove unnecessary focus_invalidated field (#7320)
I believe at some point this was used for tests but it doesn't seem
necessary anymore.

Release Notes:

- N/A
2024-02-03 05:41:58 -07:00
Antonio Scandurra
c906fd232d
Reduce GPU memory usage (#7319)
This pull request decreases the size of each instance buffer and shares
instance buffers across windows.

Release Notes:

- Improved GPU memory usage.

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
2024-02-03 05:27:08 -07:00
Dzmitry Malyshau
2e32f5867e linux: various fixes across the crates to make it compile 2024-02-03 00:06:20 -08:00
Dzmitry Malyshau
7c7aad5e76 blade: port underline shader 2024-02-02 23:04:56 -08:00
Dzmitry Malyshau
04e49dc493 blade: refactor the atlas to not own the command encoder 2024-02-02 22:22:18 -08:00
Conrad Irwin
1a82470897
Open URLs with cmd-click (#7312)
Release Notes:

- Added ability to cmd-click on URLs in all buffers

---------

Co-authored-by: fdionisi <code@fdionisi.me>
2024-02-02 22:05:28 -07:00
Antonio Scandurra
15edc46827
Maintain smooth frame rates when ProMotion and direct mode are enabled (#7305)
This is achieved by starting a `CADisplayLink` that will invoke the
`on_request_frame` callback at the refresh interval of the display.

We only actually draw frames when the window was dirty, or for 2 extra
seconds after the last input event to ensure ProMotion doesn't downclock
the refresh rate when the user is actively interacting with the window.

Release Notes:

- Improved performance when using a ProMotion display with fast key
repeat rates.

---------

Co-authored-by: Nathan Sobo <nathan@zed.dev>
2024-02-02 16:42:46 -07:00
Marshall Bowers
115f0672fb
gpui: Add support for observing window appearance (#7294)
This PR adds support to GPUI for observing when the appearance of a
window changes.

Based on the initial work done in
https://github.com/zed-industries/zed/pull/6881.

Release Notes:

- N/A
2024-02-02 13:13:35 -05:00
Antonio Scandurra
a0b52cc69a
Scope line layout cache to each window (#7235)
This improves a performance problem we were observing when having
multiple windows updating at the same time, where each window would
invalidate the other window's layout cache.

Release Notes:

- Improved performance when having multiple Zed windows open.

Co-authored-by: Max Brunsfeld <max@zed.dev>
2024-02-02 09:11:20 -08:00
Antonio Scandurra
659423a4a1
Use Mutex instead of a RefCell to acquire/release instance buffers (#7291)
This fixes a panic happening when releasing an instance buffer.
Releasing the buffer happens on a different thread but the borrow
checker was not catching it because the metal buffer completion handler
API doesn't have a `Send` marker on it.

Release Notes:

- N/A
2024-02-02 09:53:07 -07:00
Thorsten Ball
3d76ed96f5
Use command_buffer.wait_until_scheduled in metal renderer (#7283)
This commit goes back to using `wait_until_scheduled` as opposed to
`wait_until_completed`. What this means, however, is that another draw
could take place before the previous one finished. When that happens we
don't want to reuse the same instance buffer because the GPU is actively
reading from it, so we use a pool instead.

Release Notes:

- Fixed a bug that caused inconsistent frame rate when scrolling on
certain hardware.

---------

Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Antonio <antonio@zed.dev>
2024-02-02 09:09:58 -07:00
Thorsten Ball
2940a0ebd8
Revert "Avoid excessive blocking of main thread when rendering in direct mode (#7253)" (#7272)
This reverts commit 020c38a891 because it
leads to glitches when selecting text.



https://github.com/zed-industries/zed/assets/1185253/78c2c184-bc15-4b04-8c80-a23ca5c96afa



Release Notes:

- N/A
2024-02-02 10:33:08 +01:00
Dzmitry Malyshau
c000d2e16b blade: path sprite rendering 2024-02-02 00:34:08 -08:00
Dzmitry Malyshau
fdaffdbfff linux: path rasterization shader 2024-02-01 22:56:50 -08:00
Dzmitry Malyshau
05c42211fe linux: implement RWH for LinuxWindow 2024-02-01 22:05:59 -08:00
Dzmitry Malyshau
ed679c9347 WIP path rasterization 2024-02-01 21:43:28 -08:00
Dzmitry Malyshau
ce84a2a671 linux: refactor window structure, support move callback 2024-02-01 21:43:28 -08:00
Dzmitry Malyshau
c9ec337034 linux: share corner picking code between shaders 2024-02-01 21:43:28 -08:00
Dzmitry Malyshau
666b134d20 linux: shadow rendering 2024-02-01 21:43:28 -08:00
Dzmitry Malyshau
8aa768765f linux: basic quad renderer logic 2024-02-01 21:41:15 -08:00
Dzmitry Malyshau
503ac7a251 linux: work around the mutex locks for request_frame and resize 2024-02-01 21:40:54 -08:00
Dzmitry Malyshau
74fde5967b linux: hook up render event, basic renderer command buffer 2024-02-01 21:40:54 -08:00
Dzmitry Malyshau
7f8c64aa6c linux: port from x11rb to xcb and hook up RawWindowHandle 2024-02-01 21:40:54 -08:00
Dzmitry Malyshau
aed363d3c7 x11: create window and route events 2024-02-01 21:29:07 -08:00
Dzmitry Malyshau
cefc98258f linux: hook up X11rb for Window creation 2024-02-01 21:29:07 -08:00
Dzmitry Malyshau
e95bf24a1f linux: basic window, display, and atlas 2024-02-01 21:29:07 -08:00
Dzmitry Malyshau
b0376aaf8f linux: start the text system 2024-02-01 21:28:37 -08:00
Dzmitry Malyshau
ca62d22147 linux: implement dispatcher, add dummy textsystem 2024-02-01 21:28:16 -08:00
Dzmitry Malyshau
d675abf70c Add Linux platform, gate usage of CVImageBuffer by macOS 2024-02-01 21:28:16 -08:00
Dzmitry Malyshau
ef4ef5f0e8 Add blade dependency 2024-02-01 21:27:43 -08:00
Max Brunsfeld
020c38a891
Avoid excessive blocking of main thread when rendering in direct mode (#7253)
Release Notes:

- Fixed a bug that caused inconsistent frame rate when scrolling on
certain hardware.

Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2024-02-01 15:39:41 -08:00
Antonio Scandurra
5424c8bfd5
Introduce a fast path for drawing quads with no borders / corner radii (#7231)
This will introduce an extra conditional but saves us from doing a bunch
of math in the simple case of drawing simple rectangles that aren't
rounded or don't have borders.


![Figure_1](https://github.com/zed-industries/zed/assets/482957/cba95ce2-2d9a-46ab-a142-35368334eb75)

Release Notes:

- Improved rendering performance.
2024-02-01 09:49:27 -08:00
Conrad Irwin
2187513026
app version to server (#7130)
- Send app version and release stage to collab on connect
- Read the new header on the server

Release Notes:

- Added the ability to collaborate with users on different releases of
Zed.
2024-01-31 15:46:24 -07:00
Piotr Osiewicz
5941102aac
gpui: Add runtime-shaders feature so that Xcode.app is no longer necessary for Nix-based workflows (#7148)
Release Notes:

- N/A

Co-authored-by: Niklas <niklas@niklaskorz.de>
2024-01-31 17:37:16 +01:00
Marshall Bowers
e338f34097
Sort dependencies in Cargo.toml files (#7126)
This PR sorts the dependency lists in our `Cargo.toml` files so that
they are in alphabetical order.

This should make them easier to visually scan when looking for a
dependency.

Apologies in advance for any merge conflicts 🙈 

Release Notes:

- N/A
2024-01-30 21:41:29 -05:00
Marshall Bowers
2e7f9c48bb
Use fully-qualified name to avoid an unused import (#7104)
This PR adjusts how we implement `Global` conditionally to avoid an
unused import when compiling in release mode.

Release Notes:

- N/A
2024-01-30 14:57:54 -05:00
Mikayla Maki
a54eaaecee
Add raw window handle implementations to GPUI (#7101)
This is in preparation for experiments with wgpu. This should have no
external effect.

Release Notes:

- N/A
2024-01-30 11:42:28 -08:00
Marshall Bowers
1d794dbb37
Only impl Global for DebugBelow when compiling with debug_assertions (#7102)
This PR fixes this error when compiling a release build:

<img width="504" alt="Screenshot 2024-01-30 at 2 30 38 PM"
src="https://github.com/zed-industries/zed/assets/1486634/96470735-2b9e-4945-b4c3-c86ef0168b8c">

`DebugBelow` only exists when compiling with `debug_assertions`, so we
only want to implement it using that same criterion.

Release Notes:

- N/A
2024-01-30 14:37:29 -05:00
Piotr Osiewicz
e6ebe7974d
gpui: Add Global marker trait (#7095)
This should prevent a class of bugs where one queries the wrong type of
global, which results in oddities at runtime.

Release Notes:

- N/A

---------

Co-authored-by: Marshall <marshall@zed.dev>
Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
2024-01-30 14:08:20 -05:00
Conrad Irwin
c07355265f
Add logging for the font_descriptor panic (#7097)
Release Notes:

- Fixed a panic caused by an inconsistency in font metrics.
2024-01-30 11:16:43 -07:00
Marshall Bowers
2980f0508c
Rework loading images from files (#7088)
This PR is a follow-up to #7084, where I noted that I wasn't satisfied
with using `SharedUri` to represent both URIs and paths on the local
filesystem:

> I'm still not entirely happy with this naming, as the file paths that
we can store in here are not _really_ URIs, as they are lacking a
protocol.
>
> I want to explore changing `SharedUri` / `SharedUrl` back to alway
storing a URL and treat local filepaths differently, as it seems we're
conflating two different concerns under the same umbrella, at the
moment.

`SharedUri` has now been reverted to just containing a `SharedString`
with a URI.

`ImageSource` now has a new `File` variant that is used to load an image
from a `PathBuf`.

Release Notes:

- N/A
2024-01-30 11:26:02 -05:00
Marshall Bowers
6c7893db35
Rename SharedUrl to SharedUri (#7084)
This PR renames `SharedUrl` to `SharedUri` to better reflect its intent.

I'm still not entirely happy with this naming, as the file paths that we
can store in here are not _really_ URIs, as they are lacking a protocol.

I want to explore changing `SharedUri` / `SharedUrl` back to alway
storing a URL and treat local filepaths differently, as it seems we're
conflating two different concerns under the same umbrella, at the
moment.

Release Notes:

- N/A
2024-01-30 09:54:23 -05:00
Hans
843916d585
Fix two typos (#7056) 2024-01-30 10:17:06 +02:00
Bennet Bo Fenner
dd74643993
gpui: Support loading image from filesystem (#6978)
This PR implements support for loading and displaying images from a
local file using gpui's `img` element.

API Changes:
- Changed `SharedUrl` to `SharedUrl::File`, `SharedUrl::Network`

Usage:
```rust
// load from network
img(SharedUrl::network(...)) // previously img(SharedUrl(...)

// load from filesystem
img(SharedUrl::file(...))
```

This will be useful when implementing markdown image support, because we
need to be able to render images from the filesystem (relative/absolute
path), e.g. when implementing markdown preview #5064.

I also added an example `image` to the gpui crate, let me know if this
is useful. Showcase:
<img width="872" alt="image"
src="https://github.com/zed-industries/zed/assets/53836821/b4310a26-db81-44fa-9a7b-61e7d0ad4349">

**Note**: The example is fetching images from [Lorem
Picsum](https://picsum.photos) ([Github
Repo](https://github.com/DMarby/picsum-photos)), which is a free
resource for fetching images in a specific size. Please let me know if
you're okay with using this in the example.
2024-01-29 21:56:51 -08:00
Marshall Bowers
0cb8b0e451
Clean up Cargo.toml files (#7044)
This PR cleans up some inconsistencies in the `Cargo.toml` files that
were driving me crazy.

Release Notes:

- N/A
2024-01-29 23:47:20 -05:00
Julia
941e838be9 Prevent z-index id shuffle when number of z-indicies in the scene change 2024-01-29 13:08:40 -05:00
Julia
849a1324f7 Fix hovering over elements nested inside their parents
Co-Authored-By: Conrad Irwin <conrad@zed.dev>
2024-01-29 13:08:40 -05:00
Piotr Osiewicz
8fbc88b708
Load embedded fonts directly from .rdata instead of cloning (#6932)
The fonts we embed in Zed binary (Zed Sans & Zed Mono) weigh about 30Mb in total and we are cloning them several times during startup and loading of embedded assets (once explicitly in Zed and then under the hood in font-kit). Moreover, after loading we have at least 2 copies of each font in our program; one in .rdata and the other on the heap for use by font-kit.
This commit does away with that distinction (we're no longer allocating the font data) and slightly relaxes the interface of `TextSystem::add_fonts` by expecting one to pass `Cow<[u8]>` instead of `Arc<Vec<u8>>`. Additionally, `AssetSource::get` now returns `Cow<'static, [u8]>` instead of `Cow<'self, [u8]>`; all existing implementations conform with that change.

Note that this optimization takes effect only in Release builds, as the library we use for asset embedding - rust-embed - embeds the assets only in Release mode and in Dev builds it simply loads data from disk. Thus it returns `Cow<[u8]>` in it's interface. Therefore, we still copy that memory around in Dev builds, but that's not really an issue. 
This patch makes no assumptions about the build profile we're running under, that's just an intrinsic property of rust-embed.

Tl;dr: this should shave off about 30Mb of memory usage and a fair chunk (~30ms) of startup time.

Release Notes:
- Improved startup time and memory usage.
2024-01-29 10:06:57 +01:00
Piotr Osiewicz
f7b6bfefe6
chore: Remove rerun-if-changed clause that might cause spurious rebuilds (#4193)
Something is stomping over the timestamp of generated scene.h right
after the build script finishes:
`Dirty gpui v0.1.0 (/Users/someonetoignore/work/zed/zed/crates/gpui):
the file target/debug/build/gpui-ca04eedfe8d0e13c/out/scene.h has
changed (1705922004.637000680s, 1s after last build at
1705922003.507431315s)`
^ That's an output of `-v` flag added to either `cargo run` or `cargo
build`.
This comes up when you do `cargo build` followed by `cargo run` or
another `cargo build`; the artifact is not getting reused, even though
it should be possible?
Release Notes:
- N/A
2024-01-28 15:35:53 +01:00
William Desportes
ac3e0afb3d
fix: move anyhow dependency to dependencies (#6866)
Was moved by mistake in: ebbe52e6b0

This was throwing errors everywhere on Linux because anyhow is needed by
the code and is not macOS dependent.


Release Notes:

- N/A
2024-01-27 16:08:06 +02:00
Conrad Irwin
8bc105ca1d
Simplify Membership Management (#6747)
Simplify Zed's collaboration system by:
- Only allowing member management on root channels.
- Disallowing moving sub-channels between different roots.
- Disallowing public channels nested under private channels.

This should make the mental model easier to understand, and makes it
clearer
who has what access. It is also significantly simpler to implement, and
so
hopefully more performant and less buggy.

Still TODO:
- [x] Update collab_ui to match.
- [x] Fix channel buffer tests.

Release Notes:

- Simplified channel membership management.
2024-01-26 11:17:16 -07:00
Conrad Irwin
08de0d88b1 Update channel moving to match 2024-01-26 10:07:51 -07:00
Christian Clauss
cff2e8bbe0 Fix typos discovered by codespell 2024-01-25 18:32:32 +01:00
gmorenz
dd07d2f8a2
Update cocoa to crates.io version (#6452)
https://github.com/servo/core-foundation-rs/pull/457 was released in
cocoa 0.25, so this patch dependency on github can be removed.

Release Notes:

- N/A
2024-01-25 10:04:29 +02:00
Conrad Irwin
1c2859d72b
collab errors (#4152)
One of the complaints of users on our first Hack call was that the error
messages you got when channel joining failed were not great.

This aims to fix that specific case, and lay the groundwork for future
improvements.

It adds two new methods to anyhow::Error

* `.error_code()` which returns a value from zed.proto (or
ErrorCode::Internal if the error has no specific tag)
* `.error_tag("key")` which returns the value of the tag (or None).

To construct errors with these fields set, you can use a builder API
based on the ErrorCode type:

* `Err(ErrorCode::Forbidden.anyhow())`
* `Err(ErrorCode::Forbidden.message("cannot join channel").into())` - to
add any context you want in the logs
* `Err(ErrorCode::WrongReleaseChannel.tag("required", "stable").into())`
- to add structured metadata to help the client handle the error better.


Release Notes:

- Improved error messaging when channel joining fails.
2024-01-24 23:23:58 -07:00
Conrad Irwin
01424a62ea Allow prompts to have detail, and use for good
Make channel panel errors louder
2024-01-24 23:15:37 -07:00
Sean Aye
5fcc75be1f
gpui: Add hello world example (#6465)
Added hello world example to the gpui crate copied from https://gpui.rs

Release Notes:

- N/A
2024-01-25 01:03:53 -05:00
Conrad Irwin
249a6da54a Fix circular locking in prompts
Sometimes Cocoa calls app delegate methods (notably the display link)
while we're calling Cocoa methods. This causes a deadlock unless we
are careful to run cocao methods while we're not holding our internal
locks
2024-01-24 19:40:01 -07:00
Joseph T. Lyons
40dbe15b2a Update all links point to community 2024-01-24 15:11:17 -05:00
Mikayla Maki
a7368904f3
Revert "Ensure that notify observations are sent during Window::draw()" 2024-01-24 10:50:52 -08:00
Patrick Dubroy
291f353085
Fix registers link in README.md (#5389)
It looked to me that `registers` was intended to be a link here...if I'm
wrong, feel free to ignore :-)

Release Notes:

- N/A
2024-01-24 13:21:08 -05:00
Antonio Scandurra
4665b9afb6
Improve startup time (#4248)
Since our last measurements, startup time in Zed had regressed quite
significantly. This was due to several issues:

- We were loading IBMPlex, which we're not really using in the UI.
- Images were being parsed in the foreground, thus blocking the main
thread
- Language models (for semantic index and assistant) were being loaded
in the foreground, thus blocking the main thread
- Interaction with the keychain was blocking the main thread

In addition to these, with this pull request we will now deserialize the
items for a pane in parallel, as opposed to doing so sequentially.

All combined, when running the zed binary directly this brings startup
time from ~350ms to ~210ms on my machine.

Release Notes:

- Improved startup time.
2024-01-24 15:39:05 +01:00
Antonio Scandurra
25a7eb27d2 Move interaction with keychain off the main thread 2024-01-24 14:53:05 +01:00
Mikayla Maki
b9218ae80b
Add module documentation to GPUI and make gpui.rs example compile (#4241)
[[PR Description]]

Release Notes:

- N/A
2024-01-24 05:19:15 -08:00
Antonio Scandurra
92b0184036 Load images in the background 2024-01-24 13:15:31 +01:00
Antonio Scandurra
526ea40005
Log if element arena allocation is >80% (#4246)
We recently doubled the size of the `ELEMENT_ARENA` after someone ran
into a panic due to the arena running out of space.

This adds some logging so that we can hopefully develop a better
understanding of when the element area's allocation is elevated.

Release Notes:

- N/A
2024-01-24 12:48:05 +01:00
Thorsten Ball
e01850642f
Cache font-missing result to avoid unnecessary lookups (#4245)
This fixes the performance problem we saw in
https://github.com/zed-industries/community/issues/2405.

In a trace we could see that if a font is missing we'd constantly look
it up and never cache that it's missing.

This changes that and does cache the font-is-missing result.

Drawback is that one would need to restart Zed after installing a
missing font that was configured in settings. That seems acceptable for
now, though.

Release Notes:

- Improved rendering performance when configured fonts are missing on
the system.
2024-01-24 11:07:11 +01:00
Thorsten Ball
18f5752f04 Log if element arena allocation is >80%
We recently doubled the size of the `ELEMENT_ARENA` after someone ran
into a panic due to the arena running out of space.

This adds some logging so that we can hopefully develop a better
understanding of when the element area's allocation is elevated.

Co-authored-by: Antonio <antonio@zed.dev>
2024-01-24 11:03:28 +01:00
Thorsten Ball
4800991f28 Cache font-missing result to avoid unnecessary lookups
This fixes the performance problem we saw in https://github.com/zed-industries/community/issues/2405.

In a trace we could see that if a font is missing we'd constantly look
it up and never cache that it's missing.

This changes that and does cache the font-is-missing result.

Drawback is that one would need to restart Zed after installing a
missing font that was configured in settings. That seems acceptable for
now, though.

Co-authored-by: Antonio <antonio@zed.dev>
2024-01-24 10:38:38 +01:00
Antonio Scandurra
b640e0e7af Increase capacity of element arena to 8MB
This fixes a panic we just saw on nightly. It's the first time we
see this panic, so I think it's pretty safe to assume having twice as
much capacity will fix it.
2024-01-24 10:14:26 +01:00
Mikayla
ce0ff819f9
Fix more tests 2024-01-23 21:49:05 -08:00
Mikayla
fa6acc385f
Add note about discord 2024-01-23 21:41:06 -08:00
Mikayla
ce7cd5a077
Copy GPUI documentation to README 2024-01-23 21:35:01 -08:00
Mikayla
d80959d64e
Add module documentation to GPUI and make gpui.rs example compile 2024-01-23 21:29:12 -08:00
Marshall Bowers
c07e416dc0
Clean up gpui docs (#4240)
This PR does some cleanup of the `gpui` docs, making sure we're linking
things appropriately and following good Rust documentation style.

Release Notes:

- N/A
2024-01-23 23:20:05 -05:00
Mikayla Maki
1aa02ac4b6
Ensure that notify observations are sent during Window::draw() (#4236)
This PR fixes a bug in GPUI where the observation API would not be
triggered if a focus event caused a `notify()`

Release Notes:

- N/A
2024-01-23 20:17:34 -08:00
Mikayla
83363008f9
Call notify observers during Window::draw() 2024-01-23 16:52:34 -08:00
Marshall Bowers
63d86fb137
Add barebones GPUI README (#4235)
This PR adds a barebones README to the `gpui` crate, just so folks have
somewhere to land on when we link them here from
[gpui.rs](https://www.gpui.rs/).

We can flesh this out as we go.

Release Notes:

- N/A
2024-01-23 19:22:49 -05:00
Mikayla Maki
9f6072c6b6
Revert "Improve completion, action and shared project popovers' layout" 2024-01-23 15:26:11 -08:00
Kirill Bulatov
bf35b78380 Allow both action and completion lists to occupy max width and height of its element 2024-01-23 22:42:06 +02:00
Julia
c4a028d38d
Make was_top_layer_under_active_drag more closely match logic of was_top_layer (#4222)
Release Notes:

- N/A
2024-01-23 14:04:49 -05:00
Julia
21d6751c48 Make was_top_layer_under_active_drag more closely match logic of was_top_layer
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2024-01-23 12:44:23 -05:00
Conrad Irwin
61dfec2b75
Add keymatch modes so terminal can have cmd-k (#4219)
This isn't my favorite idea of a fix, but it does work for now, and it
seems likely the terminal will need to configure other aspects of action
dispatch in the future.

In the future we should explore making it possible to do this via the
keymap, either by making disabling bindings more robust; or by having a
way to indicate immediate mode per binding.

Release Notes:

- Fixed a bug where cmd-k in terminal took 1s
2024-01-23 10:23:45 -07:00
Piotr Osiewicz
21e6b09361
Remove license-file from Cargo.toml as it is apparently redundant (#4218)
Release Notes:

- N/A
2024-01-23 17:40:30 +01:00
Conrad Irwin
056da0a0f1 Add keymatch modes so terminal can have cmd-k
This isn't my favorite idea of a fix, but it does work for now, and it
seems likely the terminal will need to configure other aspects of action
dispatch in the future.

In the future we should explore making it possible to do this via the
keymap, either by making disabling bindings more robust; or by having a
way to indicate immediate mode per binding.
2024-01-23 09:37:44 -07:00
Piotr Osiewicz
678bdddd7d
chore: Add crate licenses. (#4158)
- GPUI and all dependencies: Apache 2
- Everything else: AGPL

Here's a script that I've generated for it:
https://gist.github.com/osiewicz/6afdd6626e517da24a2092807e6f0b6e

Release Notes:
- N/A

---------

Co-authored-by: David <david@zed.dev>
2024-01-23 16:56:22 +01:00
Thorsten Ball
bf843e2131 Cache last used layer_id for StackingOrder
This optimizes rendering time by saving computation of the layer_id and
comparison when inserting it into the `BTreeMaps`.

Co-authored-by: Antonio <antonio@zed.dev>
2024-01-23 11:46:11 +01:00
Conrad Irwin
5a9f1e4eb7
fix local collab tests (#4209)
I was unable to run the collab tests locally because I would run out of
file descriptors.

From some digging it turned out that tokio allocates a new file
descriptor to do work on the CurrentThread using KQUEUE.

We create a new tokio Runtime with each database connection, and these
database connections were being retained by the Client, which is
retained by the Context.

Cleaning up our leaked contexts (and an unrelated retain cycle in the
UserStore) fixes the problem (though does make me
wonder if a different approach might be preferrable).

Release Notes:

- N/A
2024-01-22 23:17:23 -07:00
Conrad Irwin
d4e83e48bd Fix docs 2024-01-22 23:10:53 -07:00
Conrad Irwin
0b1b758f02 Fix leaking test contexts
I was unable to run the collab tests locally because I would run out of
file descriptors.

From some digging it turned out that tokio allocates a new file
descriptor to do work on the CurrentThread using KQUEUE.

We create a new tokio Runtime with each database connection, and these
database connections were being retained by the Client, which is
retained by the Context.

Cleaning up our leaked contexts fixes the problem (though does make me
wonder if a different approach might be preferrable).
2024-01-22 23:05:54 -07:00
Mikayla
a241a13d60
fix test 2024-01-22 19:42:25 -08:00
Mikayla
938b84c045
Finish documenting GPUI 2024-01-22 19:33:45 -08:00
Mikayla
eab2e21126
Document more styling functions 2024-01-22 19:31:31 -08:00
Mikayla
a99d5b87e8
WIP: text_system 2024-01-22 19:30:40 -08:00
Mikayla
0c3fb449f0
Document geometry 2024-01-22 19:30:40 -08:00
Mikayla
1902df9316
WIP: Start geometry crate 2024-01-22 19:30:40 -08:00
Mikayla
1f94463ce2
Switch Arc<Mutex<Keymap>> to Rc<RefCell<Keymap>>, a relic of the GPUI2 port.
Make gpui pass clippy
2024-01-22 19:30:38 -08:00
Kirill Bulatov
a75fa35a08 Fix the fonts panic
co-authored-by: Piotr <piotr@zed.dev>
2024-01-23 00:23:48 +02:00
Conrad Irwin
2445df8bdd Remove unused import? 2024-01-22 13:37:14 -07:00
Conrad Irwin
a1c4716eeb
Potential fix for #2422 (#4197)
- it seems like layer.drawable_size() is 0,0 in metal_renderer.rs:189 
- we set this in two places:
    - in response to a CALayerDelegate setFrameSize: event
- in response to a CALayerDelegate viewDidChangeBackingProperties:
event.
- it looks like if we don't set it in either of these cases we get a
different failure mode: the view is zoomed just wrong.
- That said, I can reproduce the screenshot if .scale_factor() returns
0.
- This might happen if [nativeWindow screen] is nil, which happens when
the window is off screen.
    - possible that zed started with offscreen window?
- I would expect that viewDidChangeBackingProperties would fire when
that changed.
    - potential fix: default to 2.0

Release Notes:

- Fixed Zed occasionally rendering blank on laungh
([#2422](https://github.com/zed-industries/community/issues/2422)).
2024-01-22 11:25:02 -07:00
Mikayla Maki
e896941981
Fix certain hovers being cut off (#4196)
Release Notes:

- Fixes a bug where the bottom of hover popovers would be cut off
([#2434](https://github.com/zed-industries/community/issues/2434)).
2024-01-22 10:19:39 -08:00
Conrad Irwin
72cb865108
jk (#4189)
Add support for mapping `jk` to escape in vim mode.

This changes the behaviour of the keymatches when there are pending
matches.

Before: Even if there was a pending match, any complete matches would be
triggered and the pending state lost.

After: If there is a pending match, any complete matches are delayed by
1s, or until more keys are typed.

Release Notes:

- Added support for mapping `jk` in vim mode
([#2378](https://github.com/zed-industries/community/issues/2378)),
([#176](https://github.com/zed-industries/community/issues/176))
2024-01-22 11:12:43 -07:00
Conrad Irwin
41a99c686b Potential fix for #2422 2024-01-22 11:10:15 -07:00
Mikayla
6419df82ee
Fix certain hovers being cut off 2024-01-22 09:49:07 -08:00
Conrad Irwin
c49477746e TYPO 2024-01-22 09:56:59 -07:00
Conrad Irwin
0903d29ab3 Improve logic for reused bindings, add docs. 2024-01-22 09:53:04 -07:00
Julia
3b3252b040 Rewrote and documented was_top_layer logic
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2024-01-22 11:50:47 -05:00
Julia
455d5eeb89 Preserve stacking order ID order when reusing cached view state
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2024-01-22 10:50:52 -05:00
Conrad Irwin
6c4d024237 TYPO 2024-01-22 08:40:21 -07:00
Conrad Irwin
c5d7c8e122 Fix cmd-k left 2024-01-22 08:38:20 -07:00
Julia
831769ce8c Ignore stacking order entry ids in was_top_layer 2024-01-22 10:16:59 -05:00
Julia
2c3d9805a4 Store a z-index id per-layer
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2024-01-22 10:16:59 -05:00
Conrad Irwin
7ec4f22202 de-dbg! 2024-01-22 08:14:30 -07:00
Antonio Scandurra
de64de22a3 Introduce a ZED_MEASUREMENTS env var and use it to measure frame time 2024-01-22 11:39:20 +01:00
Conrad Irwin
b9c7bafc80 Merge remote-tracking branch 'origin/main' into jk 2024-01-21 22:03:54 -07:00
Conrad Irwin
4143d3a36e Work on tests 2024-01-21 22:00:35 -07:00
Mikayla
b65cae5874
Moved Frame struct into element context, to be close to it's associated methods 2024-01-21 20:52:24 -08:00
Mikayla
c05edee2b5
Port the rest of the app 2024-01-21 20:26:33 -08:00
Mikayla
df4566fd1e
Refactor out element context from GPUI 2024-01-21 19:43:35 -08:00
Conrad Irwin
9d261cf859 Merge branch 'main' into jk 2024-01-21 20:36:18 -07:00
Conrad Irwin
8c541b4930 Comment out tests for nwo 2024-01-21 20:16:14 -07:00
Conrad Irwin
b06e2eb6af Update handling of 'pending' keys
Before this change if you had a matching binding and a pending key,
the matching binding happened unconditionally.

Now we will wait a second before triggering that binding to give you
time to complete the action.
2024-01-21 20:12:01 -07:00
Mikayla
2f9958621b
Do an initial pass on refactoring out ElementContext from WindowContext 2024-01-21 18:40:20 -08:00
Mikayla Maki
a8990baaac
Document more gpui (#4187)
Also add several `TODO!(docs)` comments to places that need more
feedback.

Release Notes:

- N/A
2024-01-21 15:10:04 -08:00
Mikayla
118a3461a7
Restore erronously removed APIs 2024-01-21 14:33:34 -08:00
Mikayla
660a391806
Fix typos, mark docs related todos in GPUI 2024-01-21 14:28:40 -08:00
Mikayla
aa57a4cfbc
Document / lockdown more of GPUI 2024-01-21 14:26:45 -08:00
Conrad Irwin
b8ed83a452 Refactor key dispatch to work in terms of bindings 2024-01-21 12:27:26 -07:00
Piotr Osiewicz
6c82380232 chore: Fix clippy::needless_borrow up to an editor 2024-01-21 15:03:24 +01:00
Thorsten Ball
29e74a648f
When searching in visual mode switch to normal mode (#4178)
This matches Neovim behaviour by setting the mode to `Normal` when using
search while in visual mode.

Release Notes:

- Fixed Vim mode not switching to normal mode from visual mode when
using search (`/`) while in visual mode.
2024-01-21 08:42:47 +01:00
Mikayla
476de329b3
Fix issues in element comment 2024-01-20 20:19:01 -08:00
Mikayla
2083fdcaf6
Fix compile issue 2024-01-20 20:15:43 -08:00
Mikayla
bf878b8257
Document the canvas and div 2024-01-20 20:15:23 -08:00
Mikayla
a44aae9e91
Finish documenting the action, asset, color, and element modules in GPUI
Remove SmallVec from the public API of GPUI
2024-01-20 20:15:23 -08:00
Conrad Irwin
3b84291343
Updates to chat after Hack#2 (#4175)
Release Notes:

- Channels: Improved font sizes in chat
- Channels: Added a link preview when hovering over links in chat
- Channels: Fixed rendering of newlines in chat messages
- Added a new setting "use_autoclose" (defaulting to true) that lets you
disable autoclose per language.
([#1420](https://github.com/zed-industries/community/issues/1420))
([#1903](https://github.com/zed-industries/community/issues/1903))
2024-01-20 20:03:37 -07:00
Mikayla
4184686e8d
Lock down test platform implementation 2024-01-20 15:03:36 -08:00
Mikayla
017661818d
Fix typo 2024-01-20 14:42:38 -08:00
Mikayla
9da6b8c7f6
Lock down mac os platform type visibility in the rest of GPUI
Add documentation to all platform types
2024-01-20 14:38:03 -08:00
Conrad Irwin
29ac1fd081 Merge remote-tracking branch 'origin/main' into chat-font-size 2024-01-20 14:51:53 -07:00
Thorsten Ball
87be105af7 When searching in visual mode switch to normal mode
This matches Neovim behaviour by setting the mode to `Normal` when using
search while in visual mode.

Co-authored-by: Conrad <conrad@zed.dev>
2024-01-20 16:33:07 +01:00
Mikayla
33105486aa
Make platform input handler private
Automatically record the context on non-view input handlers
Simplify the async window context update() method
2024-01-20 06:56:19 -08:00
Conrad Irwin
23d991962a Link previews in chat 2024-01-19 16:59:17 -07:00
Conrad Irwin
cb84043400 Merge branch 'main' into fix-notification-positioning 2024-01-19 12:55:52 -07:00
Conrad Irwin
00e46fdde0 Fix positioning of windows on secondary displays
CGDisplayBounds returns data in "global display coordinates" (which are
the same as Zed's coordinates), different from the NS APIs which use
"screen coordinates" (which have the Y axis inverted)

Also remove some transmutes while we're at it
2024-01-19 12:51:59 -07:00
Marshall Bowers
1cc7f66f86
Fix documentation labels obscuring other content in completion menu (#4167)
This PF fixes an issue where the documentation labels in the completion
menu could end up completing obscuring the primary content.

#### Before
<img width="691" alt="Screenshot 2024-01-19 at 1 42 19 PM"
src="https://github.com/zed-industries/zed/assets/1486634/187f2978-08be-4f5e-ba93-91ed09cd6e87">

#### After

<img width="704" alt="Screenshot 2024-01-19 at 1 39 45 PM"
src="https://github.com/zed-industries/zed/assets/1486634/e5929c04-bace-4336-b878-4ada5660d235">

Since this involved changes to the `ListItem`, I also made sure to test
the other problematic case that was fixed in #3845 to make sure we
didn't regress there:

<img width="665" alt="Screenshot 2024-01-19 at 1 39 11 PM"
src="https://github.com/zed-industries/zed/assets/1486634/14b72d44-b6a6-4aef-a708-37fb60b8875a">

I also tried to capture these cases in the `ListItem` stories to make it
easier to test all of them at once:

<img width="1141" alt="Screenshot 2024-01-19 at 1 40 03 PM"
src="https://github.com/zed-industries/zed/assets/1486634/333886ff-e394-4cba-89db-98352481c7f6">

Release Notes:

- Fixed an issue where documentation labels could obscure other content
in the editor completion menu
([#2419](https://github.com/zed-industries/community/issues/2419)).
2024-01-19 14:01:09 -05:00
Conrad Irwin
2166f071b3
Fix panic in window open (#4148)
Fix a panic caused by toggleFullScreen on one window untoggling
full-screen on
another.

I managed to reproduce this only once, which makes me sad, but this
change
should fix it regardless.

https://zed-industries.slack.com/archives/C04S6T1T7TQ/p1705631681238979

Release Notes:

- Fixed an occasional panic when opening a new fullscreen window.
2024-01-19 11:08:06 -07:00
Marshall Bowers
01f06f96a1
Update tenses of doc comment summary lines (#4161)
This PR updates the tenses used by the summary line of doc comments to
match the [Rust API documentation
conventions](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#summary-sentence).

Specifically:

> The summary line should be written in third person singular present
indicative form. Basically, this means write ‘Returns’ instead of
‘Return’.

I'm sure there are plenty occurrences that I missed.

Release Notes:

- N/A
2024-01-19 11:18:50 -05:00
Antonio Scandurra
9446e573e9 Reuse layout for view's element when it wasn't cached 2024-01-19 10:26:39 +01:00
Conrad Irwin
d76bd100f5
Show cursors for remote participants (#4082)
This PR enables cursors for remote participants.

They are shown for 2 seconds when you focus a buffer, and then on hover.

Release Notes:

- Added usernames next to remote cursors
2024-01-18 20:58:09 -07:00
Conrad Irwin
87d60beda7 Fix a double borrow error in window.open
It seems that sometimes calling toggleFullScreen will cause the
display_layer callback of a different window to fire.
2024-01-18 20:55:50 -07:00
Marshall Bowers
decf320a74
Rename overflow_hidden_{x,y} to overflow_{x,y}_hidden (#4146)
This PR renames the `overflow_hidden_x` and `overflow_hidden_y` methods
to `overflow_x_hidden` and `overflow_y_hidden`, respectively.

This provides consistency with our `overflow_x_scroll` /
`overflow_y_scroll` methods, as well as better matches Tailwind's
naming.

Release Notes:

- N/A
2024-01-18 22:10:41 -05:00
Mikayla Maki
bac2e59eac
Fix popin for project panel by pre-resolving keybindings in the project panel (#4141)
Also, factors out the fluent building APIs from IntoElement into their
own traits.

Also makes the project panel context menu initialization fluent:

<img width="1328" alt="Screenshot 2024-01-18 at 3 33 45 PM"
src="https://github.com/zed-industries/zed/assets/2280405/3468b6f2-07f0-48cf-bec1-ac0379333209">

Release Notes:

- Fixed pop in when right clicking on the project panel.
2024-01-18 16:16:50 -08:00
Mikayla Maki
20b58fea35
Merge branch 'main' into fix-popin-for-project-panel 2024-01-18 15:55:35 -08:00
Marshall Bowers
3542b99c9d
Tweak the description of the gpui crate (#4142)
This PR tweaks the description of the `gpui` crate, since it's now the
only version.

There can only be one!

Release Notes:

- N/A
2024-01-18 18:52:16 -05:00
Mikayla
903176d8ff
Pull out fluent builder helpers into re-usable trait 2024-01-18 15:31:31 -08:00
Max Brunsfeld
7860372beb
gpui: Always recompute layout on cache miss. (#4131)
I'm not yet sure whether this is 100% correct, but it seems to alleviate
the following issue:
`When opening a dock, the panel doesn't appear right away. An empty dock
is briefly visible.`
Release Notes:

- Fixed panel layout being incorrect for a brief time after opening
(fixes https://github.com/zed-industries/community/issues/2415)
2024-01-18 14:44:35 -08:00
Conrad Irwin
bfee008bb2 Merge branch 'main' into cursors 2024-01-18 14:03:27 -07:00
Conrad Irwin
6c2da0d25b Revert "Store a z-index id per-layer (#4128)"
This reverts commit 28a2337218, reversing
changes made to e992f84735.
2024-01-18 13:28:23 -07:00
Conrad Irwin
81baefb460
Fix right click handler for tabs (#4130)
Also, some fun test helpers

Co-Authored-By: Mikayla <mikayla@zed.dev>

You can now use .debug_selector() to make it possible for tests to find
a given element,
and .debug_bounds() to find the coordinates of where it was painted.


Release Notes:

- (Added|Fixed|Improved) ...
([#<public_issue_number_if_exists>](https://github.com/zed-industries/community/issues/<public_issue_number_if_exists>)).
2024-01-18 13:07:25 -07:00
Piotr Osiewicz
4408d45f7a gpui: Always recompute layout on cache miss. 2024-01-18 20:55:41 +01:00
Conrad Irwin
920eced1d5 Fix right click handler for tabs
Also, some fun test helpers

Co-Authored-By: Mikayla <mikayla@zed.dev>
2024-01-18 12:10:38 -07:00
Julia
bc2302f723 Store a z-index id per-layer
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2024-01-18 13:24:25 -05:00
Thorsten Ball
b30efc9e81 Fix missing icons: set svg_renderer when assets are updated
Co-authored-by: Mikayla <mikayla@zed.dev>
2024-01-18 16:26:54 +01:00
Nathan Sobo
9e37232a13 Merge remote-tracking branch 'origin/main' into ownership-post 2024-01-18 07:01:54 -07:00
Nathan Sobo
f9165938b0 More adjustments for blog post 2024-01-18 07:01:46 -07:00
Piotr Osiewicz
0a0921f88b gpui: Bring back family and style names in font name suggestions 2024-01-18 12:10:17 +01:00
Antonio Scandurra
559461923f Remove unused PlatformAtlas::clear method 2024-01-18 10:40:15 +01:00
Nathan Sobo
bef1b83265 Add ownership post example 2024-01-17 21:19:28 -07:00
Nathan Sobo
1d3ca8eb5d Adjust APIs for simpler examples in blog post 2024-01-17 21:19:28 -07:00
Mikayla Maki
aa7351041d
Add typo detection to CI (#4107)
Adding the typos crate to our CI will take some doing, as we have
several tests which rely on typos in various ways (e.g. checking state
as the user types), but I thought I'd take a first stab at fixing what
it finds.

Release Notes:

- N/A
2024-01-17 17:13:47 -08:00
Mikayla
6ea23d0704
Fix canary 2024-01-17 17:03:17 -08:00
Piotr Osiewicz
ec2b299ecb
settings: Suggest fonts bundled in Zed (#4102)
Fixes an issue where Zed Sans is not being suggested as a font.

Release Notes:
- N/A
2024-01-18 00:54:07 +01:00
Mikayla
e3e3ef528e
Add typos ci 2024-01-17 15:33:14 -08:00
Mikayla
e6ca92ffa4
Fix a few more typos 2024-01-17 14:58:58 -08:00
Mikayla Maki
0711476fd5
Merge branch 'main' into fix-typos 2024-01-17 14:36:03 -08:00
Mikayla Maki
75f8748509
Document party 2 (#4106)
@mikayla-maki and @nathansobo's contributions

Release Notes:

- N/A
2024-01-17 14:33:52 -08:00
Mikayla
57400e9687
Fix typos detected by crate-ci/typos 2024-01-17 14:31:21 -08:00
Mikayla Maki
6f40da77b6
Fix scrolling in collab panel (#4105)
When the `List` element's state is `ListState::reset()`, it eagerly
trashes it's cached element heights in anticipation of a prompt render.
But, due to the recent `display_layer` changes, that re-render is not
always forthcoming. This is a problem for `ListState::scroll()`, which
depends on these cached elements to correctly calculate the new logical
scroll offset.

Solutions we attempted:

- Cache the element heights and continue the scroll calculation 
- This was conceptually incorrect, reset should only be called when the
underlying data has been changed, making any calculation with the old
results meaningless.
- Lazily re-compute the element heights in scroll 
- Beyond being a non-trivial refactor, this would probably also cause us
to double-render the list in a single frame, which is bad.
- Cache the scroll offset and only calculate it in paint 
- This solution felt awkward to implement and meant we can't supply
synchronous list scroll events.
- Delay resetting until paint 
- This means that all of the other APIs that `ListState` supplies would
give temporarily incorrect results, worsening the problem

Given these issues, we settled on the solution with the least
compromises: drop scroll events if the state has been `reset()` between
`paint()` and `scroll()`. This shifts the responsibility for the problem
out of the List element and into consumers of `List`, if you want
perfectly smooth scrolling then you need to use `reset()` judiciously
and prefer `splice()`.

That said, I tested this by aggressively scrolling the Collab panel, and
it seems to work as well as it did before.

This PR also includes some initial testing infrastructure for working
with input from the platform and rendered elements.

Release Notes:

- N/A
2024-01-17 14:11:34 -08:00
Mikayla
9eecda2dae
Update method name and partially document platform crate
co-authored-by: Nathan <nathan@zed.dev>
2024-01-17 14:07:57 -08:00
Mikayla
7a299e966a
Document view crate
co-authored-by: Nathan <nathan@zed.dev>
2024-01-17 14:07:55 -08:00
Mikayla
d67e461325
document app module in gpui 🎉
co-authored-by: Nathan <nathan@zed.dev>
2024-01-17 14:07:41 -08:00
Mikayla
6db18e8972
Drop scroll events if there's been a reset
co-authored-by: Nathan <nathan@zed.dev>
co-authored-by: Conrad <conrad@zed.dev>
2024-01-17 13:57:16 -08:00
Julia
2fbf42d7df
Z index shenanigans (#4089)
Release Notes:

- Fixed a bug allowing certain UI elements to render incorrectly when
overlapping.
2024-01-17 09:48:08 -05:00
Thorsten Ball
5b0b9ff582 Submit bigger primitive batches when rendering
Before this change we wouldn't submit all possible primitives of the
same kind that are less-than the max order.

Result was that we would submit, say, 10 paths each in a separate batch
instead of actually batching them.

This was overly strict because even if the order of two different
primitives was the same, we could have still batched the 1st primitive
kind, if its implicit ordering was less than 2nd kind.

Example: say we have the following primitives and these orders

  5x paths, order 3
  2x sprites, order 3

Previously, we would submit 1 path, 1 path, 1 path, 1 path, 1 path, then
the sprites.

With this changes, we batch the 5 paths into one batch.

Co-authored-by: Antonio <antonio@zed.dev>
2024-01-17 13:50:55 +01:00
Antonio Scandurra
9c33790809 Check if we exhausted the instance buffer prior to copying underlines
This fixes another potential segfault.
2024-01-17 09:50:55 +01:00
Antonio Scandurra
97bd3e1fde Fix segfault caused by wrong size of path sprites bytes length
Previously, we were using `size_of` but passing the wrong type in
(MonochromeSprite instead of PathSprite). This caused us to read outside
of the `sprites` smallvec and triggered the segfault.
2024-01-17 09:45:46 +01:00
Mikayla
80852c3e18
Add documentation to the new test 2024-01-16 22:34:15 -08:00
Mikayla
a99ee5e599
Fix test failures 2024-01-16 22:30:44 -08:00
Mikayla
cae35d3334
Fix draw helper, add helper traits for selecting groupings of input events 2024-01-16 22:19:55 -08:00
Conrad Irwin
0ca9f286c6 Show cursors for remote participants 2024-01-16 21:54:49 -07:00
Mikayla
db433586aa
Add some small test code for tracking down this list bug 2024-01-16 16:52:55 -08:00
Conrad Irwin
391a61cdc2
Play guess who's to blame (#4078)
We're occasionally seeing a crash in MetalRenderer::draw.

Looking at the backtrace, it seems almost certainly to be happening in
the call to `ptr::copy_nonoverlapping` on line 604 (see `#Don't Panic!`
channel notes)

As we already have added bounds checking to the destination, it seems
most
likely (however improbable) that somehow we're getting an invalid Ptr
and
length from the SmallVec.

To try and make progress on this, let's try a Vec for a bit lest there
is a subtle issue in SmallVec (though I couldn't spot one).


Release Notes:

- (maybe) Fixes SEGFAULT in MetalRenderer::draw
2024-01-16 16:10:36 -07:00