Commit Graph

1395 Commits

Author SHA1 Message Date
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
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
Conrad Irwin
cce3cf145c Play guess who's to blame 2024-01-16 15:39:37 -07:00
Piotr Osiewicz
f011953484 Rename all_font_families to all_font_names 2024-01-16 20:32:21 +01:00
Julia
60b79ef2ea Prevent content mask breaks from having the same z-index
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2024-01-16 11:23:28 -05:00
Julia
4f25df6ce2 Prevent div background/content/border from interleaving at same z-index
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2024-01-16 11:22:14 -05:00
Julia
4e0c8dcea9 Revert "Use taffy to retrieve the parent for a given layout node"
This reverts commit 5904bcf1c2.

Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2024-01-16 10:44:24 -05:00
Thorsten Ball
f938bae0a2 Use NSScreen to fetch primary display
According to Chromium source, `NSScreen::screens` should always get us
one display.

We made this change because we ran into panics caused by the previous
`unwrap()` when `CGGetActiveDisplayList` might return an empty list.
2024-01-16 14:23:10 +01:00
Thorsten Ball
03bfe3ef80 Call CGGetActiveDisplayList once to avoid panic
Previously we called CGGetActiveDisplayList twice: once to get the
number of displays and then to get the displays.

We saw a panic due to no displays being returned here. As a first
attempt to fix the panic, we're reducing the amount of calls to
CGGetActiveDisplayList and just do one with the trade-off being that we
pre-allocate 32 pointers in a Vec.
2024-01-16 12:01:54 +01:00
Max Brunsfeld
deac172e39
Restore re-rendering of editors on buffer font size changes (#4064)
Now that views are cached, we need to explicitly `.notify()` text
editors when the buffer font size changes.

* [x] Notify editors when settings change, or adjusting buffer font size
* [x] Figure out why non-focused editors still do not re-render when
adjusting buffer font size
* [x] Reset buffer font size adjustment when the size is updated in the
user's settings
2024-01-15 17:13:13 -08:00
Max Brunsfeld
1e755aa00f Notify global observers when removing a global 2024-01-15 17:02:20 -08:00
Max Brunsfeld
8f1633e798 Iterate from leaf to root when marking views dirty in notify 2024-01-15 16:49:06 -08:00
Conrad Irwin
f0ed80cd8e Fix fallback font
As this is used if you mis-spell "buffer_font_family", it should be
monospace.

Also treat "Zed Mono" and "Zed Sans" as valid fonts
2024-01-15 14:32:48 -07:00
Antonio Scandurra
69bbcba99a Preserve tooltips requested by cached views
Co-Authored-By: Nathan <nathan@zed.dev>
Co-Authored-By: Max <max@zed.dev>
2024-01-15 19:19:27 +01:00
Antonio Scandurra
0ff5603dc9 Rebuild shader header when cbindgen sources have changed
Co-Authored-By: Thorsten <thorsten@zed.dev>
2024-01-15 16:23:22 +01:00
Piotr Osiewicz
e52a2298cc
gpui: Pin to font-kit with improved OTC parsing performance. (#4047)
Details are in https://github.com/zed-industries/font-kit/pull/1; We're
not doing anything too fancy, really. Still, you should mostly see font
loading times drop significantly for font collections
Release Notes:
- Improved loading performance of large font collections (e.g. Iosevka).
Fixes https://github.com/zed-industries/community/issues/1745,
https://github.com/zed-industries/community/issues/246


https://github.com/zed-industries/zed/assets/24362066/f70edbad-ded6-4c12-9c6d-7a487f330a1b
2024-01-15 15:46:18 +01:00
Antonio Scandurra
05d05b051b Pop node from dispatch tree during cx.paint_view
Co-Authored-By: Thorsten <thorsten@zed.dev>
2024-01-15 11:46:46 +01:00
Antonio Scandurra
4ff514ca7e Merge remote-tracking branch 'origin/main' into cache
# Conflicts:
#	crates/gpui/src/elements/div.rs
2024-01-15 11:37:46 +01:00
Conrad Irwin
29ce109211
chat panel ++ (#4044)
- Update chat panel with current channel
- Open chat panel for guests
- Open chat when joining a channel with guests
- Some tweaks for chat panels
- Don't lose focus on default panel state
- Make chat prettier (to my eyes at least)
- Fix multiple mentions in one message
- Show a border when scrolled in chat
- Fix re-docking chat panel
- Move settings subscription to dock

[[PR Description]]

Release Notes:

- Opens chat by default when joining a public channel
- Improves chat panel UI
2024-01-14 13:54:10 -07:00
Conrad Irwin
e90ddba2c3 Default to Zed Sans for UI 2024-01-13 22:38:22 -07:00
Conrad Irwin
818cbb2415 Show a border when scrolled in chat 2024-01-13 22:19:21 -07:00
Conrad Irwin
f6ef07e716 Make chat prettier (to my eyes at least) 2024-01-13 21:37:13 -07:00
Mikayla
5897b18cfd
remove more commented code 2024-01-12 20:10:40 -08:00
Mikayla
3a836b8026
Remove some comments 2024-01-12 20:10:40 -08:00
Nathan Sobo
d2c436dcdc
fix bounds checks (#4038)
Ensure we `panic()` instead of crash on graphics memory buffer overflow

Also bump the buffer size to 32Mb from 8Mb to make this rarer (but still
possible)

Release Notes: Fixes some crahes due to lack of graphics buffer spacae
2024-01-12 15:28:19 -08:00
Julia
cdc227b32f Still paint group hover handler for invisible divs
Fixes bug where tab close icon show on hover is inconsistent
2024-01-12 17:44:15 -05:00
Conrad Irwin
aa5c6a8aa3 Update graphics memory assert to be more helpful 2024-01-12 14:35:50 -07:00
Mikayla
324d1d119b
Add some context to assert 2024-01-12 12:40:37 -08:00
Conrad Irwin
551fd9ba7e Boop 2024-01-12 12:40:09 -07:00
Antonio Scandurra
817b641c17 Ensure editor elements invalidate their parent views on notify
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Conrad Irwin <conrad@zed.dev>
2024-01-12 17:36:11 +01:00