Commit Graph
100 Commits
Author SHA1 Message Date
Nathan Sobo c23f17ee0b Reorganize element-related traits 2023-11-22 11:19:43 -07:00
Nathan Sobo 33cd6f520a Clean compile with redesigned element traits 2023-11-18 21:51:47 -07:00
Nathan Sobo 0673606de8 WIP 2023-11-18 20:22:43 -07:00
Nathan Sobo adc355a1e6 Element refinement passing on ui2 2023-11-18 20:05:47 -07:00
Nathan Sobo be33f000e2 WIP: Lots of errors, starting on resurrecting derive Element 2023-11-18 00:27:40 -07:00
Nathan Sobo 23ffce9fbe WIP: Work toward eliminating Component trait
This refactor enhances the overall design by promoting reusable and composable UI component structures within the Zed project codebase.
2023-11-18 00:03:23 -07:00
Nathan Sobo 2515bbf990 Move self in Element::paint
Remove mutable state borrows in favor of state ownership in render processes to streamline element rendering.
2023-11-17 23:32:55 -07:00
Nathan Sobo 0069dd5ce6 WIP 2023-11-17 20:05:37 -07:00
Nathan Sobo c866c211b5 Make static str and SharedString implement Element 2023-11-17 13:48:01 -07:00
Nathan Sobo 2fb13cf1ca Separate WrappedLines from ShapedLines (#3350)
ShapedLines are never wrapped, whereas WrappedLines are optionally
wrapped if they are associated with a wrap width. Originally, when
rewriting GPUI, I tried to combine everything because wrapping is
inherently optional for the Text element, but we have a bunch of APIs
that don't make sense on a line that may wrap, so we need a distinct
type for that case.

This is a precursor to implementing clickable links in markdown. I
noticed multiple places where we were confused about whether or not the
line was wrapped so this felt important.

Release Notes:

- N/A
2023-11-16 23:20:35 -07:00
Nathan Sobo 9558da8681 Separate WrappedLines from ShapedLines
ShapedLines are never wrapped, whereas WrappedLines are optionally wrapped if
they are associated with a wrap width. I tried to combine everything because
wrapping is inherently optional for the Text element, but we have a bunch of
APIs that don't make sense on a line that may wrap, so we need a distinct type
for that case.
2023-11-16 23:10:51 -07:00
Nathan Sobo e5ada92b7b Remove initialize from the Element trait (#3338)
Initially, we imagined registering keyboard handlers in the initialize
phase so we would understand the relationships between focus handles
during the layout pass, which would allow us to assign assign `focus_in`
styles that impact layout.

However, we soon realized that many elements aren't created until paint
time anyway, such as within the uniform list. Since it's impossible to
know prior to paint whether an element contains the focused element, it
makes more sense to eliminate the `focus_in` styling helper.

Release Notes:

- N/A
2023-11-15 19:36:35 -07:00
Nathan Sobo 4f09633379 Remove focus_in styling helper 2023-11-15 14:17:49 -07:00
Nathan Sobo c6b374ebc9 Remove initialize method from Element trait 2023-11-15 14:11:19 -07:00
Nathan Sobo e37d7f5b0e Fix click events by notifying when we assign pending_mouse_down (#3329)
We need to notify when we set the pending mouse down so we attach the
mouse up event listener before the mouse button is released.

Release Notes:

- N/A
2023-11-14 19:55:23 -07:00
Nathan Sobo 32ad486a8e Document contexts 2023-11-14 19:52:51 -07:00
Nathan Sobo 00d8921ae9 Fix click events by notifying when we assign pending_mouse_down 2023-11-14 19:22:41 -07:00
Nathan SoboandJulia bef4df5df9 Return an id from Element::element_id instead of calling cx.with_element_id
Co-Authored-By: Julia <julia@zed.dev>
2023-11-14 16:05:28 -07:00
Nathan Sobo bb584cc7c4 WIP 2023-11-14 11:00:52 -07:00
Nathan Sobo e08f1690b3 Remove commented field 2023-11-14 09:33:28 -07:00
Nathan Sobo 6abaacc457 Fix formatting 2023-11-14 01:58:10 -07:00
Nathan Sobo 364e3e7de5 Merge remote-tracking branch 'origin/main' into element-types 2023-11-14 01:55:58 -07:00
Nathan Sobo c6e8a097a3 Rename back to div 2023-11-14 01:41:55 -07:00
Nathan Sobo be18c47912 Remove unnecessary with_element_id calls 2023-11-14 01:38:13 -07:00
Nathan Sobo a5306c2312 Remove div module 2023-11-14 01:25:10 -07:00
Nathan Sobo 80014a28ea No compile errors or warnings 2023-11-14 01:23:09 -07:00
Nathan Sobo 27fb381cca Checkpoint 2023-11-14 01:15:48 -07:00
Nathan Sobo ce30a689a0 Checkpoint 2023-11-13 23:15:45 -07:00
Nathan Sobo 9382a304c4 Checkpoint 2023-11-13 23:03:14 -07:00
Nathan Sobo 1668330764 Checkpoint 2023-11-13 22:51:44 -07:00
Nathan Sobo 4a3a1ad0c3 Checkpoint 2023-11-13 22:42:19 -07:00
Nathan Sobo 54a817a5ab Checkpoint 2023-11-13 22:28:33 -07:00
Nathan Sobo f71afdb0f2 Checkpoint 2023-11-13 22:22:09 -07:00
Nathan Sobo 83a5f74493 Checkpoint 2023-11-13 22:02:05 -07:00
Nathan Sobo 044d9679ab Checkpoint 2023-11-13 21:40:02 -07:00
Nathan Sobo 872b5186e2 Checkpoint 2023-11-13 19:23:07 -07:00
Nathan Sobo 922bb3195b WIP 2023-11-13 18:58:42 -07:00
Nathan Sobo 76754c559c WIP 2023-11-13 18:18:25 -07:00
Nathan Sobo aec7955ccf Checkpoint 2023-11-13 16:40:29 -07:00
Nathan Sobo 7eaba8fabc WIP 2023-11-10 14:47:45 -07:00
Nathan SoboandAntonio Scandurra 74a0d9316a Add a DispatchTree which will replace the existing key dispatch strategy
Instead of freezing a stack, we will record the entire dispatch tree so we can
change focus.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2023-11-10 11:56:14 -07:00
Nathan Sobo 408a495aaf Call init 2023-11-09 13:14:11 -07:00
Nathan Sobo f5f9d881d7 Polish actions macros 2023-11-09 11:57:13 -07:00
Nathan Sobo 8c44f6a814 Simplify input handling (#3282)
This PR takes a different approach to input handling.

Rather than returning the optional input handler, focus handle pair from
the element trait, we instead allow you to register an input handler
imperatively on the window context with `WindowContext::handle_input`.
You pass a focus handle reference and any implementer of
`PlatformInputHandler`. There's an `ElementInputHandler<V>` that
implements `PlatformWindowHandler` so long as `V` implements
`InputHandler`.

Release Notes:

- N/A
2023-11-08 22:27:36 -07:00
Nathan Sobo d52c5646b4 Add docs 2023-11-08 22:03:26 -07:00
Nathan Sobo 7c922ad6ee Remove comments 2023-11-08 21:49:21 -07:00
Nathan Sobo 8278a07354 Actually set the input handler 2023-11-08 21:43:14 -07:00
Nathan Sobo 9a022671a2 Simplify IME support 2023-11-08 21:06:00 -07:00
Nathan Sobo d67581875f Register actions statically / globally (#3264)
This updates our approach to action registration to make it
static/global.

There are 3 different approaches to creating an action, depending on the
complexity of your action's implementation. All of them involve defining
a data type with the correct trait implementations and registering it,
each a bit more powerful / verbose.

* Define a simple list of unit structs that implement `Action` -
`actions!(Foo, Bar, Baz)`
* Make a more complex data type into an action with `#[action]`. This
derives all the necessary traits and registers the action.
  ```rs
  #[action]
  struct MoveLeft {
    word: true
  }
  ```
* Implement all traits yourself and just register the action with
`#[register_action]`.

Release Notes:

N/A
2023-11-07 22:05:59 -07:00
Nathan Sobo 408edaae39 Remove call to removed method 2023-11-07 21:58:46 -07:00
Nathan Sobo 1949fa5147 Merge remote-tracking branch 'origin/main' into register-actions 2023-11-07 21:56:08 -07:00
Nathan Sobo 2a55b0dbfb Simplify actions macro. 2023-11-07 21:48:47 -07:00
Nathan Sobo fdc9ea7f9b Docs and cleanup 2023-11-07 21:26:51 -07:00
Nathan Sobo 814e62050c Register actions globally before main 2023-11-07 20:58:37 -07:00
Nathan Sobo 80630cd4d9 WIP 2023-11-07 20:23:02 -07:00
Nathan Sobo fbee6b5352 Get editor2 compiling with a ton of code commented out 2023-11-02 23:35:20 -06:00
Nathan Sobo f3b8a9d8c2 WIP 2023-11-02 22:56:04 -06:00
Nathan Sobo a731f8fb1e WIP 2023-11-02 21:28:56 -06:00
Nathan Sobo dfc7c81500 WIP 2023-11-02 21:03:29 -06:00
Nathan Sobo 72b9dc8216 Merge remote-tracking branch 'origin/main' into editor2 2023-11-02 20:47:09 -06:00
Nathan Sobo 6a89f7ce4f rich text2 (#3220)
- git -> git3
- Add rich_text2

[[PR Description]]

Release Notes:

N/A
2023-11-02 20:46:45 -06:00
Nathan Sobo 2a12e8f307 Merge remote-tracking branch 'origin/rich_text2' into editor2 2023-11-02 20:34:52 -06:00
Nathan Sobo 9052b48949 Use correct color values in quad fragment shader (#3217)
Previously, when using rounded corners, the borders would get wider.
Looks like we weren't using the input color values consistently in the
fragment shader. The quad values are raw HSLA and are converted in the
vertex shader.

Release Notes:

- N/A
2023-11-02 17:49:56 -06:00
Nathan Sobo 7b712ac68f WIP 2023-11-02 16:47:14 -06:00
Nathan SoboandJulia Risley 91f3e9707a Use correct color values in quad fragment shader
Co-Authored-By: Julia Risley <julia@zed.dev>
2023-11-02 13:18:20 -06:00
Nathan Sobo d1cb2d3e11 Enforce Send bound on next frame callback functions, because they're invoked on arbitrary threads (#3215)
This enforces the send bound, then uses an async task looping on a
channel to run callbacks on the main thread.
2023-11-02 12:36:38 -06:00
Nathan Sobo 29d8390743 Fix formatting 2023-11-02 12:28:58 -06:00
Nathan Sobo 1dd20d4c0a Merge remote-tracking branch 'origin/main' into gpui2-image-reborrow 2023-11-02 12:25:06 -06:00
Nathan SoboandJulia Risley 04a8ee222b Enforce a Send bound on next frame callbacks
This required using mpsc channels to invoke frame callbacks on the
main thread and send the receiver to the platform display link.

Co-Authored-By: Julia Risley <julia@zed.dev>
2023-11-02 12:01:22 -06:00
Nathan Sobo 52e195b47c WIP 2023-11-02 07:46:49 -06:00
Nathan Sobo 3e7df82977 WIP: Merge branch 'main' into zed2-workspace 2023-11-01 22:35:02 -06:00
Nathan Sobo 6cab5c2885 Restore foreground/background distinction and confine application state to the main thread (#3206)
The potential for deadlock and other complexity ended up convincing us
that the benefits of making the app state accessible from any thread
were not worth their cost. We probably could have gone back to the old
executors, but we decided to fix forward and continue to get the
benefits of the new dispatcher.
2023-11-01 21:29:28 -06:00
Nathan Sobo 64ee1bb7a5 Fix prod compile error 2023-11-01 21:19:06 -06:00
Nathan Sobo 2079cd641e Fix post-merge compile errors 2023-11-01 21:16:41 -06:00
Nathan Sobo db9ccd7f34 Merge remote-tracking branch 'origin/main' into gpui2-no-send 2023-11-01 21:10:31 -06:00
Nathan Sobo 57dfc50687 Get language2 tests passing by not blocking on a foreground task 2023-11-01 21:04:17 -06:00
Nathan Sobo 53066df522 Get project2 tests green 2023-11-01 20:14:40 -06:00
Nathan Sobo 3f34a8e7ec Checkpoint 2023-11-01 14:00:26 -06:00
Nathan Sobo 11b6d9e33a Split out a foreground and background executor 2023-11-01 13:53:45 -06:00
Nathan Sobo d47ef6470b WIP 2023-10-31 22:32:18 -06:00
Nathan Sobo 4da8ee1e1d Remove one todo from the critical path 2023-10-31 21:19:32 -06:00
Nathan Sobo 0ecf6bde73 WIP 2023-10-31 16:15:30 -06:00
Nathan Sobo fd15551d97 Remove Reference 2023-10-31 11:29:13 -06:00
Nathan Sobo 8f1000ea10 Checkpoint 2023-10-31 11:27:08 -06:00
Nathan Sobo 9798d65cf9 Checkpoint 2023-10-31 11:22:40 -06:00
Nathan Sobo 90601fe4fd Checkpoint 2023-10-31 11:16:08 -06:00
Nathan Sobo 0a2fde8707 WIP 2023-10-31 11:03:01 -06:00
Nathan Sobo e27427dce8 Merge branch 'gpui2-docs' into zed2 2023-10-27 17:07:28 -06:00
Nathan Sobo f88ca2e7da Add docs for window.rs, but still incomplete 2023-10-27 22:29:59 +02:00
Nathan Sobo ad7c49e4bb Add doc comments to app.rs 2023-10-27 21:19:48 +02:00
Nathan Sobo bcdffc9963 Merge branch 'zed2-views' into zed2 2023-10-26 19:41:59 +02:00
Nathan Sobo a1c3826858 Add View::update which provides a ViewContext 2023-10-26 19:41:42 +02:00
Nathan Sobo f4cff69729 WIP: Macro not working fully yet 2023-10-26 13:18:58 +02:00
Nathan Sobo 0285284ae1 Rename IntoAnyElement trait to Component 2023-10-26 12:46:52 +02:00
Nathan Sobo 8ecfea55cd Replace derive Element with derive IntoAnyElement everywhere 2023-10-26 12:38:23 +02:00
Nathan Sobo 315744ec20 Add derive macro for IntoAnyElement 2023-10-26 12:20:46 +02:00
Nathan Sobo 927278e20d Remove IntoAnyElement bound from Element trait 2023-10-26 11:49:36 +02:00
Nathan Sobo db15db45ce WIP 2023-10-26 11:31:47 +02:00
Nathan Sobo 45a8aea0f0 Make FnOnces that render elements IntoAnyElement 2023-10-26 11:21:42 +02:00
Nathan Sobo db7d12f628 WIP 2023-10-26 10:59:27 +02:00