Commit Graph

17158 Commits

Author SHA1 Message Date
Thorsten Ball
1cbdf2ba22 Fix overlapping block headers when using custom line height
This fixes block headers overlapping over text in the buffer when using
a custom line height of 1.25.

It fixes the issue by making the parent container a v-flex,
vertically-justifying the content and moving from relative padding to
absolute padding for the header itself.

Co-authored-by: antonio <antonio@zed.dev>
Co-authored-by: julia <julia@zed.dev>
Co-authored-by: marshall <marshall@zed.dev>
2024-01-16 17:20:27 +01:00
Antonio Scandurra
47f2d556aa
Revert "Use taffy to retrieve the parent for a given layout node" (#4070)
This reverts commit 5904bcf1c2.

Release Notes:

- N/A
2024-01-16 16:57:36 +01: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
0bf66e486a
Call CGGetActiveDisplayList once to avoid panic (#4069)
This contains two changes in order to hopefully avoid the panic we saw
in #panics:

```
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value'
crates/gpui/src/platform/mac/display.rs:30
<backtrace::capture::Backtrace as core::fmt::Debug>::fmt
<backtrace::capture::Backtrace as core::fmt::Debug>::fmt
Zed::init_panic_hook::{closure#0}
std::panicking::rust_panic_with_hook
std::panicking::rust_panic_with_hook
std::sys_common::backtrace::output_filename
<std::panicking::begin_panic_handler::FormatStringPayload as core::panic::PanicPayload>::take_box
core::panicking::panic_fmt
core::panicking::panic
gpui::platform::mac::display::display_bounds_to_native
<gpui::platform::mac:🪟:MacWindow as gpui::platform::PlatformWindow>::bounds
<gpui:🪟:WindowContext>::window_bounds_changed
<gpui:🪟:Window>:🆕:{closure#1}
gpui::platform::mac:🪟:view_did_change_backing_properties
<gpui::platform::mac::platform::MacPlatform as gpui::platform::Platform>::run
Zed::main
<core::marker::PhantomData<core::option::Option<Zed::LocationData>> as serde:🇩🇪:DeserializeSeed>::deserialize::<&mut serde_json:🇩🇪:Deserializer<serde_json::read::StrRead>>
workspace::open_new::<Zed::restore_or_create_workspace::{closure#0}::{closure#0}::{closure#0}::{closure#2}::{closure#0}>::{closure#0}::{closure#0}
std::rt::lang_start_internal
serde_json:🇩🇪:from_trait::<serde_json::read::StrRead, core::option::Option<Zed::Panic>>
```

Two changes:
* Reduce the number of calls to `CGGetActiveDisplayList` in the hopes
that this will also reduce chances of it returning an empty list.
Previously, in the worst case, we called it 6 times. Now the worst case
is that we call it 3 times.
* Instead of calling `CGGetActiveDisplayList` to get the primary display
we do what Chromium does and construct the primary display from
NSScreen.

Release Notes:

- Fixed a bug that caused a panic that could happen when Zed attempted
to render on a sleeping display.
2024-01-16 14:40:46 +01: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
Kirill Bulatov
ed78f705eb
Fix previous theme not being applied on startup (#4068)
Fixes `[2024-01-16T09:21:54Z ERROR util]
crates/theme/src/settings.rs:172: theme not found: One Light` error from
the log after
d84785f7e8

Release Notes:

- N/A
2024-01-16 11:45:06 +02:00
Kirill Bulatov
074966427d Fix previous theme not being applied on startup 2024-01-16 11:23:34 +02:00
Kirill Bulatov
ec3cfc33d6
Adds a way to select items under multiple carets (#4067)
Deals with https://github.com/zed-industries/community/issues/2374

Release Notes:

- Added a way to select items under multiple carets with
`editor::SelectNext` and `editor::SelectPrevious` commands
2024-01-16 11:08:48 +02:00
Kirill Bulatov
25abe8f981 Fix the tests 2024-01-16 10:58:27 +02:00
Kirill Bulatov
fbb363e83a Add tests 2024-01-16 10:07:31 +02:00
Nate Butler
dde0056845 Use srgb, get mix and blend working 2024-01-16 01:08:17 -05:00
Nate Butler
bdb06f183b Add a rudimentary state color builder 2024-01-16 00:07:06 -05:00
Conrad Irwin
18739477f7 Clippy 2024-01-15 20:12:20 -07:00
Conrad Irwin
036e637208 Disallow self-management for admins 2024-01-15 19:31:01 -07:00
Conrad Irwin
62232060e6 Close modals when focus leaves
This is more similar to zed1's behaviour, and allows us to work around
the difficulty in defining `on_mouse_down_out` for modals that have
overlays.
2024-01-15 19:20:35 -07:00
Joseph T. Lyons
47971ec2c7
Add command palette action events (#4065)
Release Notes:

- N/A
2024-01-15 20:31:34 -05:00
Joseph T. Lyons
268d156fad Add command palette action events 2024-01-15 20:22:47 -05: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
d84785f7e8 Put back logic for resetting buffer font adjustment on settings change. 2024-01-15 17:03:02 -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
f220323176
Fix fallback font (#4062)
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

Follow up to #4045

Release Notes:

- Fixes font validation to allow "Zed Mono" as a valid font
2024-01-15 17:08:04 -07:00
Max Brunsfeld
8f262892a0 Notify editors on buffer font size changes 2024-01-15 14:53:24 -08:00
Max Brunsfeld
e57c32effb
Avoid playing newly published audio tracks when deafened (#4040)
Release Notes:

- Fixed a bug where the 'deafen' button would only apply to audio from
the call's current participants, but not any participants who joined
after the button was pressed.
- Fixed a bug where after being granted write access to a channel, the
microphone icon appeared non-muted, even though audio was not shared.
2024-01-15 14:08:49 -08:00
Max Brunsfeld
e90794d3ec Add and enhance tests for muting/deafening, fix exposed logic errors 2024-01-15 14:03:38 -08:00
Nate Butler
8c9f3a7322 init color crate 2024-01-15 17:01:07 -05:00
Kirill Bulatov
55671eac40 Select next/previous word for multiple carets if possible 2024-01-15 23:42:36 +02:00
Joseph T. Lyons
acf85db44e
Add more open events (#4061)
Adds open events for

- Welcome page
- Project search
- Project diagnostics

Release Notes:

- N/A
2024-01-15 16:36:24 -05:00
Antonio Scandurra
b565c44a9e
Avoid panicking when closing a dragged tab (#4057)
Release Notes:

- Fixed a panic that could occur when closing a tab while dragging it.
2024-01-15 22:34:33 +01: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
Joseph T. Lyons
24db41fcdd Remove debugs 2024-01-15 16:29:58 -05:00
Joseph T. Lyons
355d1fca82 Remove button event function 2024-01-15 16:28:28 -05:00
Joseph T. Lyons
148c294c02 Removed button event 2024-01-15 16:26:56 -05:00
Joseph T. Lyons
ba9a9f4f17 Add more open events
project search
diagnostics
welcome page
2024-01-15 16:26:04 -05:00
Piotr Osiewicz
9a70a89477
Fix project panel being toggled on workspace startup. (#4059)
A sequence of events: Launch Zed -> Quit Zed -> Launch Zed would leave
you with a project panel in a a different state on each open (e.g. if it
is open on 1st one, 2nd run will have it closed). We were essentially
not tracking whether the deserialization took place.

Release Notes:

- Fixed project panel being toggled on/off on startup due to incorrect
tracking of serialization state (solves
https://github.com/zed-industries/community/issues/2406)
2024-01-15 22:23:16 +01:00
Conrad Irwin
97047ffaca Enable Channels for everyone 2024-01-15 13:33:58 -07:00
Kirill Bulatov
e2f08a6cca
Add LSP logs into the end of the editor, not after its caret (#4060)
Also prevent tabs from being added in readonly editors

Release Notes:

- Fixed LSP logs being inserted into the editor incorrectly
- Fixed `editor::Tab` action inserting tabs in read-only files
2024-01-15 22:22:54 +02:00
Kirill Bulatov
92add99260 Add LSP logs into the end of the editor, not after its caret
Also prevent tabs from being added in readonly editors
2024-01-15 22:12:52 +02:00
Antonio Scandurra
e60117dc54 Avoid panicking when closing a dragged tab
Co-Authored-By: Max <max@zed.dev>
Co-Authored-By: Nathan <nathan@zed.dev>
2024-01-15 19:46:34 +01:00
Antonio Scandurra
1b35b93e77
Avoid retrieving layout bounds inside of right click menu event handler (#4056)
By the time the event handler is invoked, all information about the
rendered layout tree is gone.

Release Notes:

- N/A
2024-01-15 19:42:47 +01:00
Antonio Scandurra
e4728b04ca
Preserve tooltips requested by cached views (#4055)
Release Notes:

- N/A
2024-01-15 19:42:39 +01:00
Antonio Scandurra
a56265e607 Avoid retrieving layout bounds inside of right click menu event handler
Co-Authored-By: Nathan <nathan@zed.dev>
Co-Authored-By: Max <max@zed.dev>
2024-01-15 19:27:18 +01: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
Thorsten Ball
a92b9aba42
Fix unaligned close button in tab bar (#4054)
This fixes the close button not being vertically aligned in the tab bar.


## Before
![screenshot-2024-01-15-18 13
49@2x](https://github.com/zed-industries/zed/assets/1185253/edf81b4d-a93a-461a-9835-4aba025cf337)

## After
![screenshot-2024-01-15-18 14
45@2x](https://github.com/zed-industries/zed/assets/1185253/2ae24c8c-9df3-4248-8566-fee6ce8602e0)


---

Release Notes:

- Fixed close-tab button not being vertically aligned in the tab bar.
2024-01-15 18:24:44 +01:00
Thorsten Ball
b9be2147e8 Fix unaligned close button in tab bar
Co-authored-by: Marshall <marshall@zed.dev>
2024-01-15 18:16:41 +01:00
Marshall Bowers
90f4c70a82
Rename h_stack and v_stack to h_flex and v_flex, respectively (#4053)
This PR renames the `h_stack` and `v_stack` to `h_flex` and `v_flex`,
respectively.

We were previously using `h_stack` and `v_stack` to match SwiftUI, but
`h_flex` and `v_flex` fit better with the web/flexbox terminology that
the rest of GPUI uses.

Additionally, we were already calling the utility functions used to
implement `h_stack` and `v_stack` by the new names.

Release Notes:

- N/A
2024-01-15 11:34:06 -05:00
Marshall Bowers
b136d21ebf
Make tab close button square (#4052)
This PR makes the close button for tabs square.

`IconButton` now accepts a `shape`, and using `IconButtonShape::Square`
will ensure the `IconButton` is square with respect to its contained
icon.

#### Before

<img width="119" alt="Screenshot 2024-01-15 at 10 32 40 AM"
src="https://github.com/zed-industries/zed/assets/1486634/dc806b9b-411f-4cd9-8c10-676d2cbd298b">

#### After

<img width="116" alt="Screenshot 2024-01-15 at 10 32 24 AM"
src="https://github.com/zed-industries/zed/assets/1486634/8b4ef43c-14b6-449f-a235-5d7affd82c4e">

Release Notes:

- Changed the tab close button to be square.
2024-01-15 10:43:03 -05:00
Antonio Scandurra
1da9c8b1e9
Rebuild shader header when cbindgen sources have changed (#4051)
This was causing the Metal shaders to incorrectly interpret the
primitives submitted by GPUI, which in turn caused rendering to be
completely borked.

Release Notes:

- N/A
2024-01-15 16:32:09 +01:00
Julia
ef4831b868
Prevent storybook dialog from swallowing terminal cursor when ctrl-c-ed (#4050)
Honestly thought this was a bug with our terminal port lol. Turns out
its an oversight in the `dialoguer` crate but its seems pretty easy to
work around so might as well

Release Notes:

- N/A
2024-01-15 10:25:11 -05:00