Commit Graph
15695 Commits
Author SHA1 Message Date
Antonio Scandurra e53b9f5ccf Fix Div::active not working
Somehow a condition got inverted and caused the bug.
2023-12-12 17:40:22 +01:00
Antonio Scandurra 35670368a5 Remove focus_listeners from Interactive
We're not using these anymore.
2023-12-12 17:39:07 +01:00
Antonio Scandurra c0846d6f74 Set cursor style only if we're the active window (#3607)
Release Notes:

- N/A
2023-12-12 16:56:32 +01:00
Antonio Scandurra b87c45e6f5 Set cursor style only if we're the active window 2023-12-12 16:32:45 +01:00
Kirill Bulatov 4684440202 Fix focus issues with gpui2 docks (#3606)
* Fixed dock toggling not focusing the terminal element
* Fixed loosing focus on dock close (e.g. cmd-d on the last terminal in
the dock)
* Removed element stateless focus API since it would not work when the
element is not rendered, update all API usages to the stateful one via
`gpui::Subscription`

Release Notes:

- N/A
2023-12-12 17:26:39 +02:00
Kirill BulatovandAntonio 0140bb862e Fix the tests
Co-authored-by: Antonio <antonio@zed.dev>
2023-12-12 17:19:12 +02:00
Kirill Bulatov ca8e8d1065 Finish removing all dangerous focus APIs 2023-12-12 16:11:14 +02:00
Antonio Scandurra 97eae4b081 Improve rendering performance in gpui2 (#3605)
The biggest improvements come from preventing element moves where
unnecessary, and when they are absolutely needed, try to make the struct
we're moving as small as possible. Having big structs on the stack (such
as `Interactivity`) increases the cost of moving but also reduces
opportunities for other compiler optimizations (e.g., inlining).

One more notable change was using `FxHashMap` and `FxHashSet` in hot
code paths where we don't need those collections to be resistant to DoS.

Another thing I am seeing a lot in the profiler is interacting with
`StackingOrder` (cloning it, searching for it, inserting into the
`Scene`). I have some thoughts on how to optimize that but I punted on
it because performance seems to be pretty good now.

Release Notes:

- N/A
2023-12-12 15:09:43 +01:00
Antonio Scandurra 6159a59534 Fix assertions now that we use different hash functions 2023-12-12 14:59:51 +01:00
Kirill BulatovandAntonio 2cde1a2e15 Re-focus window on workspace on corresponding window blur
Co-authored-by: Antonio <antonio@zed.dev>
2023-12-12 15:36:20 +02:00
Kirill Bulatov 717b2885f8 Attempt to remove the dangeous element focus API 2023-12-12 15:07:27 +02:00
Antonio Scandurra 43b8d65fee Transfer focus to the workspace when window focus is lost 2023-12-12 15:07:27 +02:00
Kirill BulatovandAntonio 137104e00e Fix dock panels not focusing their contents on toggle
Co-authored-by: Antonio <antonio@zed.dev>
2023-12-12 15:07:27 +02:00
Kirill Bulatov 706dd8246e Improve project panel autoreveal ergonomics (#3604)
Part of
https://linear.app/zed-industries/issue/Z-1386/add-equivalent-setting-to-vscodes-auto-reveal-exclude
Deals with https://github.com/zed-industries/community/issues/800

* add a `project_panel::auto_reveal_entries` config entry to allow
disabling auto reveal in project panel (auto reveal is enabled by
default)
* add a `pane::RevealInProjectPanel` action (and a pane tab context menu
entry) to manually reveal any file entry
* stop auto revealing gitignored directories at all

We can add the auto reveal exclude globs later, if needed, but let's try
to keep the config simpler and start with a more minimalist approach.

Release Notes:

- Improved project panel auto reveal mechanics: gitignored files are not
auto revealed anymore; a `auto_reveal_entries = true` config option for
`project_panel` is added; a `pane::RevealInProjectPanel` action and a
corresponding buffer tab context menu were added
2023-12-12 14:37:30 +02:00
Antonio Scandurra b871f906d6 Use FxHashMap and FxHashSet in hot code paths
We can also use these maps and sets in place of `SeaHasher` because
they are also deterministic. Note that we're not swapping std's
`HashMap` and `HashSet` wholesale inside of `collections` because
on the server we need cryptographically secure collections.
2023-12-12 13:35:22 +01:00
Antonio Scandurra 385c830bef Make each DispatchNode smaller by allocating more 2023-12-12 13:16:09 +01:00
Kirill Bulatov d9b0828beb Port to gpui2 2023-12-12 13:50:23 +02:00
Kirill Bulatov 721d7615c3 Add tests 2023-12-12 13:34:46 +02:00
Antonio Scandurra f312c58b30 Reduce the stack size of Interactivity at the cost of more allocations 2023-12-12 11:57:44 +01:00
Kirill Bulatov 27d6432c84 Rework the way project panel auto reveals entries
* gitignored entries are never auto revealed
* `project_panel::auto_reveal_entries = true` settings entry was added,
setting it to `false` will disable the auto reveal
* `pane::RevealInProjectPanel` action was added that activates the project panel and reveals the entry it got triggered on (including the gitignored ones)
2023-12-12 11:38:51 +02:00
Antonio Scandurra e7094cc98d Don't move interactivity unnecessarily during layout 2023-12-12 09:43:33 +01:00
Antonio Scandurra b503edf24f Avoid cloning entries in CollabPanel::render_signed_in 2023-12-12 09:42:35 +01:00
Max Brunsfeld a9f817fc14 Allow dragging and dropping files in the project panel (#3602)
Also, fix a bug that prevented drag and drop from working in the collab
panel.
2023-12-11 17:03:07 -08:00
Max BrunsfeldandMikayla 6f5b1064ee Fix detection of topmost region under the dragged item
Co-authored-by: Mikayla <mikayla@zed.dev>
2023-12-11 16:50:44 -08:00
Marshall Bowers 39a115b264 Take a first pass at styling the welcome screen (#3601)
This PR is a first pass at styling the welcome screen in Zed2.

Here's the current state:

<img width="1237" alt="Screenshot 2023-12-11 at 7 00 43 PM"
src="https://github.com/zed-industries/zed/assets/1486634/a0cbd5ca-7331-4785-bf46-f83fc4cb3bb6">

Release Notes:

- N/A
2023-12-11 19:06:33 -05:00
Max Brunsfeld cbce49ff68 Start work on dragging entries in the project panel 2023-12-11 15:52:58 -08:00
Max Brunsfeld a208229a2c Use Box instead of Rc for List event handlers 2023-12-11 15:52:06 -08:00
Conrad Irwin 149e90c3d9 vim2 (#3597)
- MOAR TESTS

[[PR Description]]

Release Notes:

- N/A
2023-12-11 16:42:03 -07:00
Marshall Bowers 75c1f0e997 Add w_vw and h_vh to StyledExt for setting sizes in viewport units (#3600)
This PR adds `w_vw` and `h_vh` methods to `StyledExt`.

These methods are the same as their `w` and `h` counterparts, but
operate in viewport units, giving us the equivalent of `vw` and `vh` in
CSS.

You can see them in action in this story:

```
cargo run -p storybook2 -- components/viewport_units
```

Release Notes:

- N/A
2023-12-11 18:19:11 -05:00
Conrad Irwin 3779316e4e Fix scroll tests
For some reason in gpui2, the window contains an extra 59px of space..
2023-12-11 16:12:17 -07:00
Max Brunsfeld 805df4fd15 Implement welcome view in zed2. (#3599)
Still needs styling.
2023-12-11 14:54:03 -08:00
Max Brunsfeld bb5fa6bc13 Implement welcome view in zed2.
Still needs styling.
2023-12-11 14:48:42 -08:00
Marshall Bowers 3120a9cbea theme_importer: Fall back to inactive tab background if no active tab background set (#3598)
This PR makes it so the `theme_importer` falls back to the inactive tab
background color if the theme doesn't not an active tab background
color.

This fixes the active tab color in the Synthwave 84 theme.

Release Notes:

- N/A
2023-12-11 17:39:46 -05:00
Conrad Irwin 2d59492aac Most tests now... 2023-12-11 15:25:30 -07:00
Conrad Irwin e37173fe97 And some more 2023-12-11 15:14:13 -07:00
Conrad Irwin 3baf125f4a All the easy tests? 2023-12-11 15:13:11 -07:00
Marshall Bowers 050ff6b27d Adjust scrollbar track background and border colors (#3596)
This PR adjusts the colors we pull from the VS Code themes to use for
the scrollbar track background and border.

For the scrollbar track background we now use the `editor.background`,
and for the scrollbar track border we use `editorOverviewRuler.border`.

Release Notes:

- N/A
2023-12-11 17:08:39 -05:00
Conrad Irwin d12eb0581a vim2 (#3594)
- First round of vim tests

Add `observe_keystrokes` back to gpui2
Allow multiple actions to match a given key event

[[PR Description]]

Release Notes:

- (Added|Fixed|Improved) ...
([#<public_issue_number_if_exists>](https://github.com/zed-industries/community/issues/<public_issue_number_if_exists>)).
2023-12-11 15:06:51 -07:00
Conrad Irwin 1e89092d62 MOAR TESTS 2023-12-11 15:06:33 -07:00
Conrad Irwin 303189e086 Fix warnings 2023-12-11 14:54:58 -07:00
Marshall Bowers e271bbe896 Use editorOverviewRuler.border for the scrollbar track border 2023-12-11 16:54:53 -05:00
Marshall Bowers dfd1b5aa11 Use the editor background for the scrollbar track background 2023-12-11 16:39:26 -05:00
Marshall Bowers aa27e1bcec Draw the scrollbar track left border 2023-12-11 16:39:00 -05:00
Mikayla Maki 927d18b0f3 Add support for resizing splits and docks, as well as utilities (#3595)
Making this PR to upstream changes to util and GPUI2, resizing exists
but isn't working yet.

Release Notes:

- N/A
2023-12-11 13:32:06 -08:00
Mikayla cb8109ab98 Remove some debug styles 2023-12-11 13:23:07 -08:00
Conrad Irwin 4942b1962b Moar tests 2023-12-11 14:21:21 -07:00
Mikayla f03c0f6e63 Add double click handling 2023-12-11 13:17:42 -08:00
Conrad Irwin d1805d8ada First round of vim tests 2023-12-11 14:16:25 -07:00
Max Brunsfeld f12510b8b0 Defer drawing the window until the CoreAnimation displayLayer: method is called (#3592)
GPUI (both 1 and 2) currently performs rendering, layout, and painting
at the end of every effect cycle. This leads to poor performance when
the app receives events more frequently than the display refreshes. Such
rapid events can come from a terminal, an LSP, or a mouse with a high
polling rate.

This PR changes GPUI so that we don't render until the OS notifies us
that the content will be presented, via the `displayLayer:` callback.

Because render, layout, and paint have side effects that are sometimes
relied on in tests, we currently keep the old behavior (drawing after
every effects cycle) in tests.

This is similar to what @ForLoveOfCats explored in
https://github.com/zed-industries/zed/pull/3542, but slightly simpler,
in that we're not using the display link. As a follow-up, we could use
the display link to start rendering earlier, to possibly reduce latency
further.
2023-12-11 13:03:04 -08:00
Marshall Bowers 41f55e4d0d Use tab.inactiveForeground from VS Code for muted text color (#3593)
This PR updates the `theme_importer` to pull in the
`tab.inactiveForeground` color from VS Code to use as the muted text
color.

Release Notes:

- N/A
2023-12-11 15:57:47 -05:00