Max Brunsfeld
d6c89521d9
Remove commented-out tests for spawn and spawn_stream
2021-05-12 15:27:58 -07:00
Nathan Sobo
a3be5595dd
Pass a handle to the current view model when spawning
...
Most of the time, we'll want a way to get a reference back to the current view or model, so this facilitates that common case.
2021-05-12 15:28:59 -06:00
Nathan Sobo and Max Brunsfeld
fa6bd1f926
Introduce AsyncAppContext and simplify spawning
...
Now when you call spawn in various context, you pass an FnOnce that is called with an AsyncAppContext and returns a static future. This allows you to write async code similar to how our tests work, borrowing the guts of the AsyncAppContext when needed to interact, but using normal async await semantics instead of callbacks.
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com >
2021-05-12 15:16:49 -06:00
Antonio Scandurra and Max Brunsfeld
2326ac3dbf
Use gpui::test for tests in gpui
...
Co-Authored-By: Max Brunsfeld <max@zed.dev >
2021-05-12 18:21:32 +02:00
Antonio Scandurra
c7d97adf23
Introduce a gpui::test macro
2021-05-12 17:05:03 +02:00
Antonio Scandurra and Nathan Sobo
e72a309734
Add a basic tab keybinding
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-05-11 17:10:37 +02:00
Antonio Scandurra and Nathan Sobo
d8eed53f13
Emit Dirtied event when a clean buffer's file is deleted
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-05-11 16:32:52 +02:00
Max Brunsfeld
f2b009ea6b
Ensure that the bundle runs on macOS versions < 11.0
2021-05-10 14:14:04 -06:00
Nathan Sobo
76d9a40f35
Merge pull request #40 from zed-industries/close-window
...
Correctly handle closing windows and removing entities
2021-05-08 09:06:54 -06:00
Nathan Sobo
2c74d75687
Fix double borrow error in Window::on_close callbacks when quitting app
...
The simplest solution I could come up with was to make quitting the app asynchronous. Calling mac::Platform::quit enqueues a request to quit the app and then allows the call stack to fully return. This ensures we aren't holding a borrow when we quit and invoke all the Window::on_close callbacks. Seems like it should be fine to be async on quitting.
2021-05-08 08:49:14 -06:00
Max Brunsfeld
9dbda4551f
Ignore events for held-down keys after a key combo is partially released
2021-05-07 16:54:55 -07:00
Max Brunsfeld
b292baf334
Remove logging of retained views
2021-05-07 14:51:55 -07:00
Max Brunsfeld
3120906275
Merge branch 'master' into close-window
2021-05-07 14:24:48 -07:00
Max Brunsfeld
83a844f120
Fix the Clone impl for AnyViewHandle
2021-05-07 14:16:16 -07:00
318e8abf2f
Avoid redundant entity refcount operations
...
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com >
Co-Authored-By: Antonio Scandurra <me@as-cii.com >
2021-05-07 14:15:43 -07:00
Max Brunsfeld
3c3cf3b7c5
Keep weak handles to workspace items
2021-05-07 09:52:15 -07:00
Nathan Sobo and Antonio Scandurra
b5f1f31693
Fix focus test
...
Call on_focus on the root view when the window is originally created. Test dropping a focused view. Simplify test to avoid relying on emitting events.
Co-Authored-By: Antonio Scandurra <me@as-cii.com >
2021-05-07 09:43:07 -06:00
Max Brunsfeld
e6323f0d02
Fix handling of new files with new buffer/file structure
2021-05-06 21:06:20 -07:00
Nathan Sobo and Max Brunsfeld
35e0eaaae2
Refocus root view if focused view is removed
...
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com >
2021-05-06 16:30:10 -06:00
Nathan Sobo and Max Brunsfeld
5e08a02ca8
Don't retain entities after EntityTasks are dropped
...
This allows us to spawn long-running tasks without leaking entities, but it also ensures that if we *do* hold on to a task, that the entity exists until the future or stream complete so that the task doesn't need to return an Option type.
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com >
2021-05-06 16:19:38 -06:00
Nathan Sobo and Max Brunsfeld
ab10e27424
Create a pending view handle before creating a view
...
This way, if we create and drop a handle during the creation of a view, we don't drop the view before we have a chance to increment its initial reference count.
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com >
2021-05-06 15:18:09 -06:00
Nathan Sobo and Max Brunsfeld
f408521d12
Gracefully handle a view being updated and removed in the same tick
...
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com >
2021-05-06 15:13:26 -06:00
Max Brunsfeld
290fcb4c06
In handle ::condition, re-poll on events as well as notifications
2021-05-06 13:18:41 -07:00
Nathan Sobo
7717700b2c
Implement Drop on AnyViewHandle
...
This was a pretty bad oversight.
2021-05-05 23:21:39 -06:00
Nathan Sobo
6cb656db9a
Require window to have a root view and focused view
...
This is possible now that the window doesn't need to own the view. We can create the root view before we create the window.
2021-05-05 23:21:19 -06:00
Nathan Sobo
45a01d1526
Don't store views on windows
...
Instead, store all views in a single top-level map that's keyed by window id and view id. This ensures we'll keep a view alive even if its window is gone, so long as we're holding a handle. This can happen with things like spawned tasks. We don't want to panic during a spawned task after we close the window.
2021-05-05 22:48:16 -06:00
Max Brunsfeld
1fcbadaa99
Add TestAppContext::simulate_new_path_selection
2021-05-05 11:04:39 -07:00
Nathan Sobo
3f844bc953
Fix crash when closing windows
2021-05-05 11:34:49 -06:00
Max Brunsfeld
5fd084ec09
Start work on creating and saving new files
2021-05-04 19:04:11 -07:00
Nathan Sobo and Max Brunsfeld
ed28bd3f95
Combine Workspace and WorkspaceView
...
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com >
2021-05-03 20:15:55 -06:00
Max Brunsfeld and Nathan Sobo
5826a976ef
Return a future from WorkspaceView::open_paths
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-04-29 14:55:28 -07:00
Nathan Sobo
6b357a6ae7
Fix tests
...
I didn't realize a previous change had broken stuff. We need to always call `remove_dropped_entities` and `update_windows` in `flush_effects`, even if there aren't any effects. To achieve this, I use a `loop` to ensure we call these methods at least once before breaking.
2021-04-28 14:16:10 -06:00
Max Brunsfeld and Antonio Scandurra
21cfb75a73
Flush redundant fs events in worktree test
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com >
2021-04-28 12:42:39 -07:00
1cb3fdbf7d
Synthesize a mouse moved event in the previous position after painting a scene
...
This ensures that we correctly update the hover state of elements whose position has changed relative to the mouse cursor even though the mouse hasn't actually moved.
Co-Authored-By: Antonio Scandurra <me@as-cii.com >
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com >
2021-04-28 13:02:39 -06:00
Nathan Sobo and Antonio Scandurra
b5463dcd1e
Close tabs when X is clicked
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com >
2021-04-28 10:00:45 -06:00
Nathan Sobo and Antonio Scandurra
8c51bb253d
Render sprited icons at 2x resolution since we don't align to pixel grid
...
This provides the sampler with a bit more data when positioning sprites at subpixel positions.
Co-Authored-By: Antonio Scandurra <me@as-cii.com >
2021-04-28 09:32:38 -06:00
Nathan Sobo
69cc2b0483
WIP
2021-04-27 18:35:24 -06:00
Nathan Sobo
58e336354e
Align close tab icon cleanly with unsaved indicator
2021-04-27 16:51:23 -06:00
Nathan Sobo and Max Brunsfeld
eca9f495a1
Render a close tab button on tab hover
...
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com >
2021-04-27 11:58:59 -06:00
Nathan Sobo and Max Brunsfeld
bb95d58c79
Relay hover events to tabs
...
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com >
2021-04-27 11:37:14 -06:00
Nathan Sobo and Antonio Scandurra
3d1e44ca29
Capture hover events on tabs
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com >
2021-04-27 09:23:44 -06:00
Nathan Sobo
fc4b7e2a2a
Introduce MouseEventHandler
...
Still need to give elements the ability to re-render their parent view. Once that is in place, I think we can implement hoverable close tab buttons.
2021-04-26 21:52:18 -06:00
Nathan Sobo
a47b0b4ca6
Add a mechanism for storing ephemeral values
...
I'll use this in the mouse event handler to track hover and click state.
2021-04-26 21:24:23 -06:00
Max Brunsfeld and Nathan Sobo
55fcc586bc
Cancel outstanding fuzzy-matching calls before starting a new one
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-04-26 16:14:43 -07:00
Max Brunsfeld and Nathan Sobo
09f5c7c23e
Fix scrollwheel events in uniformlist
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-04-26 15:53:38 -07:00
Max Brunsfeld
9fd8acdce7
Use our own scoped_pool implementation
2021-04-20 14:07:36 -07:00
9899614f31
Remove task_done condvar which supported finish_pending_tasks
...
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com >
Co-Authored-By: Antonio Scandurra <me@as-cii.com >
2021-04-20 10:45:42 -06:00
1a8e909a38
Ensure we remove broadcast channels after all conditions resolve
...
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com >
Co-Authored-By: Antonio Scandurra <me@as-cii.com >
2021-04-20 10:43:13 -06:00
dcc2bdfd4c
Panic when awaiting conditions on dropped entities
...
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com >
Co-Authored-By: Antonio Scandurra <me@as-cii.com >
2021-04-20 10:36:54 -06:00
Antonio Scandurra and Nathan Sobo
ddd746b9f9
Use env_logger instead of simplelog in tests
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-04-20 17:34:14 +02:00