Commit Graph
184 Commits
Author SHA1 Message Date
Max Brunsfeld e488eb96bc Merge branch 'master' into close-window 2021-05-07 14:24:48 -07:00
Max Brunsfeld 8c4a70f7c7 Fix the Clone impl for AnyViewHandle 2021-05-07 14:16:16 -07:00
04dcf1aca6 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 76bcbcc72c Keep weak handles to workspace items 2021-05-07 09:52:15 -07:00
Nathan SoboandAntonio Scandurra 9349aeac1a 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 19d8fa2fe3 Fix handling of new files with new buffer/file structure 2021-05-06 21:06:20 -07:00
Nathan SoboandMax Brunsfeld a0c8ac3fdc 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 SoboandMax Brunsfeld 5eb0610d47 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 SoboandMax Brunsfeld 60f2a6572a 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 SoboandMax Brunsfeld 4f61ef1383 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 3b30251112 In handle ::condition, re-poll on events as well as notifications 2021-05-06 13:18:41 -07:00
Nathan Sobo 204e91adcd Implement Drop on AnyViewHandle
This was a pretty bad oversight.
2021-05-05 23:21:39 -06:00
Nathan Sobo f4e0b69bd3 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 91f4d0ffe3 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 2e5d292c4b Add TestAppContext::simulate_new_path_selection 2021-05-05 11:04:39 -07:00
Nathan Sobo 10147df5c3 Fix crash when closing windows 2021-05-05 11:34:49 -06:00
Max Brunsfeld 02afdfa9de Start work on creating and saving new files 2021-05-04 19:04:11 -07:00
Nathan SoboandMax Brunsfeld af1c03fcdc Combine Workspace and WorkspaceView
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-05-03 20:15:55 -06:00
Max BrunsfeldandNathan Sobo 0b11e9bde1 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 cc37e37517 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 BrunsfeldandAntonio Scandurra e29bddf714 Flush redundant fs events in worktree test
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-04-28 12:42:39 -07:00
e955af12f8 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 SoboandAntonio Scandurra a620be4434 Close tabs when X is clicked
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-04-28 10:00:45 -06:00
Nathan SoboandAntonio Scandurra 63e5080199 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 5da9755007 WIP 2021-04-27 18:35:24 -06:00
Nathan Sobo ced0bca26c Align close tab icon cleanly with unsaved indicator 2021-04-27 16:51:23 -06:00
Nathan SoboandMax Brunsfeld be6859003a 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 SoboandMax Brunsfeld fa92bd1893 Relay hover events to tabs
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-04-27 11:37:14 -06:00
Nathan SoboandAntonio Scandurra e0bb313d67 Capture hover events on tabs
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-04-27 09:23:44 -06:00
Nathan Sobo 26185a24d6 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 a202aeb21d 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 BrunsfeldandNathan Sobo 766f9b6d60 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 BrunsfeldandNathan Sobo ac56309f00 Fix scrollwheel events in uniformlist
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-04-26 15:53:38 -07:00
Max Brunsfeld 4367b00060 Use our own scoped_pool implementation 2021-04-20 14:07:36 -07:00
dcd7e7d347 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
4d16b59636 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
e249900bb5 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 ScandurraandNathan Sobo 5dd6557f09 Use env_logger instead of simplelog in tests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-04-20 17:34:14 +02:00
Antonio ScandurraandNathan Sobo 91e58f9803 Time out condition after 200ms and add basic unit tests for it
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-04-20 17:21:29 +02:00
Antonio Scandurra eb174da091 Replace remaining usages of finish_pending_tasks with condition 2021-04-20 12:28:30 +02:00
Nathan Sobo 8035044bb0 WIP: Add a condition method to model and view handles for use in tests
It returns a future that resolves when the provided predicate returns true. The predicate is called any time the handle's targeted entity calls notify.

Still need to add a timeout and completely remove finsih_pending_tasks.
2021-04-19 22:01:54 -06:00
Nathan Sobo 7ecd260419 Merge branch 'master' into rescan 2021-04-14 22:26:09 -06:00
Max BrunsfeldandNathan Sobo f281528de5 Improve styling of tabs
* Enforce a min width per tab
* Center the title within tab, regardless of icon
* Render icon over the top of the tab title
* Ensure there is always a fixed minimum amount of filler to the right of all tabs

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-04-14 15:14:46 -07:00
Max BrunsfeldandNathan Sobo 889ea4cedc Avoid setting constrain min to infinity in Flex layout
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-04-14 15:14:46 -07:00
Max BrunsfeldandNathan Sobo 77924d6631 Include constraints in element tree JSON debug output
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-04-14 15:14:46 -07:00
Nathan Sobo e8e6311e2b WIP 2021-04-14 12:38:16 -06:00
Nathan SoboandBrooks Swinnerton 4aba99199e Replace easy-parallel with scoped-pool for path searches
The easy-parallel crate spawned new threads on each call, which was resulting in way too many threads.

Co-Authored-By: Brooks Swinnerton <934497+bswinnerton@users.noreply.github.com>
2021-04-14 09:08:52 -06:00
Antonio Scandurra 2a1e5657c7 Prompt for paths asynchronously to avoid double borrow 2021-04-14 16:30:03 +02:00
Antonio Scandurra 665f6d310d Merge pull request #19 from zed-industries/single-global-action-dispatch
Dispatch global actions only once when triggering a menu item
2021-04-14 15:50:07 +02:00
Antonio Scandurra 95e13efd1e Dispatch global actions only once when triggering a menu item
Previously we would dispatch the same global action more than once
because we would invoke `dispatch_action_any` _and_
`dispatch_global_action_any`. However, the former already takes care of
going through the global action handlers when no entity in the dispatch
path handled the action.
2021-04-14 14:47:18 +02:00