Commit graph

409 commits

Author SHA1 Message Date
Max Brunsfeld
936af9bc5e Avoid double borrow panic when resizing windows
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-27 15:03:37 -07:00
Max Brunsfeld
bc63fca8d7 Fetch older messages when scrolling up in the chat message list
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-27 14:58:28 -07:00
Max Brunsfeld
5262dcd3cb Don't change cursor on mouse move while mouse button is held down 2021-08-27 10:34:11 -07:00
Antonio Scandurra
5e6e0c68cd Allow styling the cursor in MouseEventHandler
Co-Authored-By: Max Brunsfeld <max@zed.dev>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-27 19:01:49 +02:00
Antonio Scandurra
53dc08dfc5 Remove lock from element states
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-27 18:04:21 +02:00
Antonio Scandurra
d5b7e2d4e3 Pass a MutableAppContext in render
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-27 17:25:13 +02:00
Antonio Scandurra
a9963f1b32 Synthesize a mouse moved event also when the mouse is dragged 2021-08-27 16:31:12 +02:00
Antonio Scandurra
7f5cd017cb Fix potential deadlock when using FontCache::em_width 2021-08-27 14:54:21 +02:00
Antonio Scandurra
8a10234b14 Introduce MouseEventHandler::on_drag 2021-08-27 14:30:08 +02:00
Antonio Scandurra
386631debf Focus toggled elements when interacting with the sidebars
Also, restore focus on the workspace when there is no active item
on the sidebar that was just toggled.
2021-08-27 10:01:44 +02:00
Max Brunsfeld
1489c865e7 Remove ui font fields from settings 2021-08-26 17:12:56 -07:00
Max Brunsfeld
3bb5610ad1 Overhaul handling of font families
* Specify font families in the theme.
* Load fonts eagerly when loading themes, instead of loading
  them lazily when rendering.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-26 15:06:00 -07:00
Antonio Scandurra
381f2499b2 Preserve scroll position of List when refreshing windows
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-26 16:46:28 +02:00
Antonio Scandurra
4388c45029 Re-render all list elements when refreshing windows
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-26 16:36:56 +02:00
Antonio Scandurra
5fe5685641 Replace notify_all with an explicit refresh_windows effect
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-26 15:00:00 +02:00
Nathan Sobo
77c7fa53da Introduce Orientation concept to List
When the Orientation is Bottom, we paint elements from the bottom of the list when underflowing and express scroll position relative to the bottom. In either orientation, when inserting elements outside the visible area, we adjust the scroll position as needed to keep the visible elements stable.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-08-25 12:45:17 -06:00
Antonio Scandurra
897826f710 Run subscription/observation callbacks in the order they were added
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-25 17:35:27 +02:00
Antonio Scandurra
1aa1e6c6ab Move pooling of line wrappers into FontCache
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-25 17:28:25 +02:00
Antonio Scandurra
0c9e72cce7 Support hard wraps in Text element
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-25 16:53:26 +02:00
Antonio Scandurra
72f282eb3a Calculate current line width correctly when wrapping shaped lines 2021-08-25 15:21:04 +02:00
Antonio Scandurra
399ecaabc6 Wrap lines in Text element 2021-08-25 14:59:52 +02:00
Antonio Scandurra
463284f0af Move LineWrapper into gpui 2021-08-25 10:43:54 +02:00
Max Brunsfeld
f404f5f32f wip2 2021-08-24 18:09:36 -07:00
Nathan Sobo
33dbbf271e WIP
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-08-24 18:09:36 -07:00
Max Brunsfeld
91c2b5825e Add LineWrapper::wrap_shaped_line
This allows us to perform wrapping based on
glyph positions in an already-shaped line. We
plan to use this in the new Text element,
because there we'll already need to do text
shaping as part of layout. This text isn't editable
so it won't need to be rewrapped with the same
frequency as the text editor's content.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-24 18:09:36 -07:00
Nathan Sobo
3ac489a8b6 Fix panic when scrolling non-overflowing lists
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-08-24 17:51:37 -06:00
Nathan Sobo
8559be9f92 Default unstyled text to be red instead of transparent 2021-08-24 17:11:27 -06:00
Max Brunsfeld
8179f90589 Add initial unit test for channel list
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-24 13:12:02 -07:00
Antonio Scandurra
54b4a4bf6a Allow editor to be created in auto-height mode 2021-08-24 14:17:15 +02:00
Max Brunsfeld
baded7d416 Start work on subscribing to model from ChatPanel 2021-08-23 17:21:06 -07:00
Max Brunsfeld
6df80d94ad Allow subscription/notification to be cancelled by dropping the returned Subscription
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-23 15:54:24 -07:00
Max Brunsfeld
fa0739ee2e Remove model and view specific observe/subscribe methods
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-23 15:07:50 -07:00
Max Brunsfeld
5ecedd894d Add ChannelList to AppState 2021-08-23 15:03:45 -07:00
Max Brunsfeld
43bb38206f Add generic subscribe and observe methods to contexts
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-23 15:03:12 -07:00
Max Brunsfeld
8e191f27d9 Simplify state associated with observations
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-23 15:03:08 -07:00
Max Brunsfeld
d02eaf9e3a Fix scrolling in List element
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-23 11:02:30 -07:00
Antonio Scandurra
a182db863f WIP: Render dummy chat messages to test List
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-23 17:29:46 +02:00
Antonio Scandurra
94e9a83326 Give up on entities being Send and Sync
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-23 17:04:32 +02:00
Antonio Scandurra
3543aceff3 Implement scrolling and painting for List
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-23 16:41:48 +02:00
Antonio Scandurra
bd89dc4114 Perform a full layout of List when width changes
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-23 16:04:23 +02:00
Antonio Scandurra
03b7c3c8c6 Implement and test splice for ListState
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-23 16:00:05 +02:00
Antonio Scandurra
2c3ba00d3e Remove vestiges of after_layout
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-23 15:23:06 +02:00
Antonio Scandurra
6dddb72e82 WIP: Create infrastructure for testing element layout
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-23 15:20:23 +02:00
Antonio Scandurra
6129bda068 Fix boxed cloning of AnyAction
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-23 14:45:13 +02:00
Antonio Scandurra
ab2977c65c Pass action instead of action argument to handlers 2021-08-23 12:00:31 +02:00
Nathan Sobo
86effd64a2 Get project compiling with type-safe actions 2021-08-22 21:02:48 -06:00
Nathan Sobo
638b533fc7 WIP 2021-08-22 13:29:54 -06:00
Nathan Sobo
24639ec900 WIP 2021-08-22 11:58:19 -06:00
Nathan Sobo
030de803fe WIP: Start on List::layout
Perform layout on any elements that we haven't yet laid out.
2021-08-21 13:40:45 -06:00
Nathan Sobo
d68e0b0b97 Remove after_layout from Element trait
Now that layout takes a MutableAppContext we don't need an after_layout phase.
2021-08-20 16:40:45 -06:00
Nathan Sobo
d0a5bc694c WIP 2021-08-20 16:34:46 -06:00
Nathan Sobo
c3dda14490 WIP: Move sum_tree module into gpui so we can use it in List 2021-08-20 16:18:39 -06:00
Max Brunsfeld
a7ac37a318 Make titlebar_height available during render
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-08-20 10:45:42 -07:00
Max Brunsfeld
5cfb948b2b Make the default window size non-zero
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-08-20 10:01:24 -07:00
Max Brunsfeld
c7c7a197d1 Merge remote-tracking branch 'origin/sexy' into chat-theme-prep 2021-08-20 09:50:58 -07:00
Antonio Scandurra
98f691d16d Make database interactions deterministic in test
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-20 16:24:33 +02:00
Nathan Sobo
a4882169c2 Fetch messages when joining a channel 2021-08-19 15:25:20 -06:00
Nathan Sobo
541f58e12c Start on subscribing to messages in channel entity instances
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-08-18 11:45:29 -06:00
Nathan Sobo
149fb574c7 Expose titlebar_height in LayoutContext 2021-08-06 09:11:16 -06:00
Nathan Sobo
e16c62ed0e Add platform::Window::titlebar_height 2021-08-06 09:08:29 -06:00
Nathan Sobo
34eb2c446f Start on custom titlebar 2021-08-05 11:48:35 -06:00
Max Brunsfeld
d37a98782e Improve border parsing in themes
The `top`, `left`, `bottom` and `right` fields are optional.
If none are specified, then they are all set to true.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-04 17:19:42 -07:00
Nathan Sobo
85a076312a Merge branch 'main' into theme-variables 2021-08-04 16:47:43 -06:00
Max Brunsfeld
802f1f4e78 Get new theme structure working
* Fix precedence of extends directives
* Always group color with font properties for text theming

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-04 14:07:19 -07:00
Nathan Sobo
56354c7623 Avoid crashes when laying out lines containing byte order marks
This solution isn't perfect and we'll probably have layout bugs with these lines, but this prevents us from triggering undefined behavior.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-08-04 11:52:21 -06:00
Nathan Sobo
90b51c3356 Implement themes::ThemeRegistry::get
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-08-03 19:35:15 -06:00
Max Brunsfeld
81041d7841 Restructure Theme with new style objects 2021-08-03 13:36:58 -07:00
Max Brunsfeld
ef0ffbe819 Use custom color wrapper type everywhere in gpui & zed
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-03 12:48:58 -07:00
Max Brunsfeld
fa01273466 Extract {Container,Label}Style structs from those elements
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-03 11:07:03 -07:00
Nathan Sobo
4c53470800 Notify all views when a theme is selected 2021-08-02 16:57:10 -06:00
Max Brunsfeld
b30d0daabf Add a theme picker
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-02 14:55:27 -07:00
Max Brunsfeld
e080739d57 Remove use of replace_with crate for managing element lifecycles
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-02 13:11:11 -07:00
Max Brunsfeld
8785f1f9c6 Use deterministic executor in randomized synchronous tests
Remove App::test function
2021-07-30 14:07:37 -07:00
Max Brunsfeld
4c3f97d123 Fix type of Workspace::open_new_file context parameter
Fixes #118
2021-07-30 10:11:46 -07:00
Max Brunsfeld
372d2ccb6d Extract most colors in codebase into theme file. switch to dark 2021-07-30 09:50:28 -07:00
Nathan Sobo
6efadd19dd Reuse FontCache across randomized tests
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-07-30 09:50:28 -07:00
Antonio Scandurra
b647e3ee71 Make WrapMap and DisplayMap models
This removes the need for a lock around in `WrapMap` and also removes
`WrapMap::notifications` because gpui already has a standard way of
notifying when a model updates.
2021-07-26 13:02:31 +02:00
Nathan Sobo
f81f043058 WIP 2021-07-23 12:25:09 -06:00
Nathan Sobo
11285f3762 Pass a MutableAppContext to Element::layout and ::dispatch_event
We need to mutate the app in these cases to relay layout state, so this just makes things easier. We won't be able to perform layout in parallel but it's questionable whether we'll ever actually do that. If we do, we can revisit.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-07-23 10:52:08 -06:00
Antonio Scandurra
502f54a021 Don't poll foreground futures during DeterministicExecutor::block_on 2021-07-23 12:06:58 +02:00
Max Brunsfeld
5d22c6c4bd Start restructuring WrapMap with simpler concurrency
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-22 16:21:42 -07:00
Max Brunsfeld
d0fdc7b5e8 Get simple unit test passing for soft-wrap in DisplayMap 2021-07-20 15:22:11 -07:00
Max Brunsfeld
61397f2f2f Avoid holding executor's state lock while parked
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-20 11:37:02 -07:00
Nathan Sobo
ee213696aa Replace DeterministicExecutor::reset with forbid_parking
There's really no point calling reset if we plan on parking afterwards.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-07-20 12:28:04 -06:00
Nathan Sobo
64927abbc4 Allow DeterministicExecutor to park until forbid_parking is called
This allows us to perform async setup such as talking to the database.
2021-07-20 12:22:02 -06:00
Antonio Scandurra
3d3a14b650 Add DeterministicExecutor::block_on(duration, future)
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-07-20 19:20:50 +02:00
Max Brunsfeld
f9e13f3429 Start work on WrapMap::chunks_at
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-19 16:23:56 -07:00
Nathan Sobo
e193a660aa WIP 2021-07-19 13:59:07 -06:00
Max Brunsfeld
05e5e5f747 Implement FontSystem::wrap_line 2021-07-16 17:14:43 -07:00
Antonio Scandurra
9895c77f5c WIP 2021-07-16 18:43:50 +02:00
Antonio Scandurra
1ba9e48271 Start on adding a randomized test for BackgroundWrapper
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-16 17:53:23 +02:00
Antonio Scandurra
2e645bcf6a Use an unbounded channel for waking executor::Deterministic
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-07-13 18:46:48 +02:00
Antonio Scandurra
c4e37dc47c Use the same background executor for spawning CPU intensive tasks
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-07-13 18:13:25 +02:00
Antonio Scandurra
f836a25500 Use an executor::Background in AppContext::thread_pool 2021-07-13 14:06:38 +02:00
Antonio Scandurra
68f747d6df Allow printing a trace of a run of the executor 2021-07-13 12:31:36 +02:00
Nathan Sobo
1537500fcb Include contents of the zed-server repo
We're going full monorepo.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-07-12 14:14:39 -06:00
Antonio Scandurra
58bae3a9a7 Ensure root view is always rendered when opening a window
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-12 17:44:10 +02:00
Antonio Scandurra
1813a3cc91 Allow resetting executor::Deterministic's RNG 2021-07-11 11:26:06 +02:00
Max Brunsfeld
eeebc761b6 Restructure Peer to handle connections' messages in order 2021-07-09 16:27:34 -07:00
Antonio Scandurra
4f4233e00b Schedule foreground-spawned futures sequentially
Co-Authored-By: Max Brunsfeld <max@zed.dev>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-09 18:55:42 +02:00