Commit Graph
100 Commits
Author SHA1 Message Date
Nathan Sobo 29bc2db6e8 Fix journal format strings 2021-12-18 12:15:07 -07:00
Nathan Sobo 34edbc7934 Merge pull request #287 from zed-industries/journal
Add a simple journaling feature
2021-12-18 11:17:18 -07:00
Nathan Sobo 0a37d40fad Pad single-digit months, days, and minutes with a leading zero 2021-12-18 11:11:04 -07:00
Nathan Sobo ab5db0bc1e Fix warnings and tests 2021-12-18 11:06:07 -07:00
Nathan Sobo e4f18947de Insert a time heading when creating a journal entry 2021-12-18 10:38:54 -07:00
Nathan Sobo 9e8ef31452 Return item handles when opening items
This will support interacting with the opened item. Although I think I should probably return the ItemView rather than the Item. Next commit.
2021-12-18 08:26:57 -07:00
Nathan Sobo ca0d7e5e1f Add journal crate and move supporting logic into workspace crate
I needed to interact with the workspace to open a file from the journal crate, so I moved a bunch of logic out of main related to opening new workspaces and paths.
2021-12-18 08:12:59 -07:00
Nathan Sobo cd65031cda Halt keystroke dispatch immediately when we call a global action handler
Someday, we may want to define a global action context that allows us to propagate the action, but this isn't currently supported. Previous to this commit, we were invoking the same global action handler multiple times, once for each view in the responder chain.
2021-12-18 08:12:08 -07:00
Nathan SoboandAntonio Scandurra 437145afbe Remove assertion and don't consume 0 bytes
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-12-15 06:52:37 -07:00
Nathan SoboandAntonio Scandurra fbba417f09 Implement MultiBuffer::bytes_in_range
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-12-15 06:49:10 -07:00
Nathan SoboandMax Brunsfeld 6c5b27af1d Group diagnostics by primary
Render primary message above the excerpt and supporting messages as block decorations with a `Below` disposition. This is still super rough.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-14 18:26:42 -07:00
Nathan SoboandMax Brunsfeld e1a2897d53 Render basic diagnostic messages in project diagnostics view
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-14 17:00:57 -07:00
Nathan SoboandMax Brunsfeld ad05c0cc7a Implement MultiBufferSnapshot::excerpt_headers_in_range
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-14 16:24:48 -07:00
Nathan Sobo cdbcbdfe6d Test undo/redo at editor layer, including selection restoration 2021-12-12 15:04:19 -07:00
Nathan Sobo 44cd0be068 Restore selections upon undo/redo of edits performed in the current editor 2021-12-12 14:12:03 -07:00
Nathan Sobo 1e7184ea07 Get selections rendering again when local selections are owned by Editor 2021-12-11 13:42:46 -07:00
Nathan Sobo 4dd0752e80 More messy progress towards selections in editors 2021-12-11 00:29:34 -07:00
Nathan Sobo 0639c8331c Relax TreeMap value bounds, fix warnings, simplify cmp 2021-12-10 23:35:24 -07:00
Nathan Sobo 49d1c9d1ba Introduce sum_tree::TreeMap<K, V>
I think this will be useful to avoid cloning HashMaps in certain cases such as snapshots.
2021-12-10 23:33:15 -07:00
Nathan Sobo f5c775fcd1 WIP 2021-12-10 22:16:39 -07:00
Nathan Sobo 8432daef6a WIP: Start on removing selections from buffer in favor of editor 2021-12-10 19:23:34 -07:00
Nathan Sobo f35c419f43 Return optional transaction ids from undo/redo
This will allow the editor to restore selections that it associated with the start or end of a transaction.
2021-12-10 18:08:26 -07:00
Nathan Sobo 77defe6e28 Return optional transaction ids when starting/ending a transaction
If the transaction was nested, we return None. Otherwise we return the transaction id in preparation for editors to maintain their own selection state.
2021-12-10 18:00:09 -07:00
Nathan Sobo c8b43e3078 Move multi_buffer to editor crate 2021-12-10 17:37:53 -07:00
Nathan Sobo dd38eb1264 Start on maintaining an insertions tree
I'm correctly assigning fragment ids to all fragments in the fragments tree, but I have a randomized test failure when making sure that the insertions tree matches the state of the fragments tree.
2021-12-08 22:05:13 -07:00
Nathan Sobo ec54010e3c Sketch in type-level changes to track insertion splits 2021-12-08 21:04:22 -07:00
Nathan Sobo 98f726974e WIP 2021-12-08 20:04:30 -07:00
Nathan Sobo 4ee404a0af Take a cx in MultiBuffer::start_transaction 2021-12-08 19:30:52 -07:00
Nathan SoboandMax Brunsfeld 87d16c271e Get Editor compiling with MultiBuffer as its buffer
There's a bunch of unimplemented methods in MultiBuffer, but everything compiles.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-08 19:23:04 -07:00
Nathan SoboandMax Brunsfeld 02f42f2877 WIP
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-06 14:51:23 -07:00
Nathan SoboandMax Brunsfeld 88e3d87098 Get randomized test passing on basic excerpt list features
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-06 13:48:07 -07:00
Nathan SoboandMax Brunsfeld 4578938ea1 Implement ExcerptList::subscribe
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-06 13:37:17 -07:00
Nathan SoboandMax Brunsfeld a02a29944c Get the basic ExcerptList unit test passing again
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-06 13:01:09 -07:00
Nathan SoboandMax Brunsfeld 6965117dd8 Allow patches to be composed with edit iterators in addition to other Patches
This can avoid an extra allocation in some cases.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-06 13:00:51 -07:00
Nathan SoboandMax Brunsfeld cff610e1ec Rename FragmentList to ExcerptList
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-06 11:59:32 -07:00
Nathan Sobo 0be897d5ac WIP: Edit one of the excerpted buffers and add an assertion
We'll need to detect edits on the child buffers and understand their impact on the tree.
2021-12-04 07:19:30 -07:00
Nathan Sobo 811696670a Start on a new FragmentList
Here I'm exploring a new approach to the project-wide diagnostics view that can exactly mirror the contents of cargo check. The `FragmentList` composes an arbitrary list of fragments from other buffers and presents them as if they were a single buffer.
2021-12-04 06:57:56 -07:00
Nathan SoboandMax Brunsfeld 5ae46709b0 Fix alignment of blocks adjacent to other blocks
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-01 17:58:44 -07:00
Nathan SoboandMax Brunsfeld ee693a8d2b Get all tests passing with new blocks API
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-01 17:52:34 -07:00
Nathan SoboandMax Brunsfeld 512a10b037 Use new BlockMap API to render diagnostics
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-01 17:22:40 -07:00
Nathan SoboandMax Brunsfeld 1445ce10b5 Name the root file of every crate after the crate to ease navigation
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-30 12:46:39 -07:00
Nathan SoboandMax Brunsfeld 748b1ba602 Fix warning
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-30 12:27:00 -07:00
Nathan SoboandMax Brunsfeld d3f28166cb Rename buffer crate to text and name its entrypoint after the crate
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-30 12:26:12 -07:00
Nathan Sobo eacd2a45bb Bump versions in preparation for release 2021-11-30 09:43:51 -07:00
Nathan Sobo df1804b215 Merge pull request #267 from zed-industries/fix-soft-wrap-disabled
Avoid building up pending edits when soft wrapping is disabled
2021-11-30 08:39:00 -07:00
Nathan SoboandAntonio Scandurra 0ed488d93b Avoid building up pending edits when soft wrapping is disabled
This was causing us to get slower over time as we stacked up hundreds of thousands of pending edits whenever soft wrap was disabled.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-11-30 08:28:29 -07:00
Nathan Sobo cb942a0e2f Merge pull request #265 from zed-industries/fix-collaborators-test
Fix flaky contacts test
2021-11-29 17:03:01 -07:00
Nathan SoboandMax Brunsfeld a1412166f0 Fix randomized test failures by waiting for client_b to be added to worktree_a
We perform an async fetch of client_b's user data on worktree_a, which ends up holding a handle that prevents worktree_a from being released later in the test. By waiting for this fetch to finish before proceeding, we can be sure worktree_a actually gets released.

A more comprehensive fix would be some way to ensure we actually perform a release if an entity is fully dropped outside of an update cycle, but this fixes the issue for now.

Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-11-29 16:48:09 -07:00
Nathan Sobo e0998dbfda Merge pull request #260 from zed-industries/show-collaborators
Show collaborators for the active worktree in the titlebar
2021-11-28 14:16:16 -07:00
Nathan Sobo 815cc7ee91 Give avatar ribbons a rounded top 2021-11-28 14:04:31 -07:00
Nathan Sobo fbc307cd5e Associate collaborator avatars with "ribbons" corresponding to their cursor color 2021-11-28 13:25:05 -07:00
Nathan Sobo a5039cad65 Tweak avatar sizes in titlebar 2021-11-28 12:41:46 -07:00
Nathan Sobo 6ce76ca13e Render active worktree collaborator avatars in the titlebar 2021-11-28 12:28:10 -07:00
Nathan Sobo 4bd43e67ef Introduce a TestClient and associate it with a PeerId
This makes it easier to integration test peer interactions because now we know their PeerIds.
2021-11-27 12:33:25 -07:00
Nathan Sobo b307a7e91d Populate the user data of worktree collaborators
This will make it possible for us to render their avatars. Previously we only had the user ids. During rendering, everything needs to be available synchronously. So now, whenever collaborators are added, we perform the async I/O to fetch their user data prior to adding them to the worktree.
2021-11-26 20:35:50 -07:00
Nathan Sobo 9930e92412 WIP: Give worktrees a reference to the UserStore
This will allow them to fetch user data when peers are added or removed. Still work to do though.
2021-11-26 19:12:12 -07:00
21aba54dc3 Introduce a worktree::Collaborator struct that holds the user_id
We can use this to render avatars.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-11-26 11:28:30 -07:00
Nathan SoboandAntonio Scandurra d78d5712be Rename PeoplePanel to ContactsPanel
Yeah, it's true they're people, but this is a more specific way in which they're people.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-11-26 11:13:05 -07:00
Nathan SoboandAntonio Scandurra c8ad5b68e0 Rename collaborator_logins to authorized_logins
Again, this is about reserving the concept of a "collaborator" for actual collaborators on a worktree.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-11-26 11:08:34 -07:00
Nathan SoboandAntonio Scandurra cd2c3c3606 Rename Collaborators to Contacts
This will allow us to use the word "collaborator" to describe users that are actively collaborating on a worktree.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-11-26 10:59:41 -07:00
Nathan Sobo 9f29eeda03 Associate Peers with a user_id
This will help us render the collaborator avatars for the active worktree when we know its peers.
2021-11-26 10:22:34 -07:00
Nathan Sobo f453928b44 Associate the project with an active worktree
This is similar to the active entry, but it can remain assigned even if there is no active entry and we can potentially manipulate it in other scenarios such as interaction with the project browser. This prepares the ground to show the collaborators for the active worktree.
2021-11-26 10:21:56 -07:00
Nathan Sobo 74cdd32c58 Merge pull request #257 from zed-industries/go-to-line-plus-mouse
Preserve selection when clicking on editor dismisses go-to-line dialog
2021-11-25 14:17:29 -07:00
Nathan Sobo f8cf534812 Merge pull request #256 from zed-industries/select-next
Implement select next (cmd-d) and replace selection with next (cmd-k cmd-d)
2021-11-25 14:10:54 -07:00
Nathan Sobo ad26362a82 Preserve selection when clicking on editor dismisses go-to-line dialog 2021-11-25 14:10:43 -07:00
Nathan Sobo fc2ae42f4b Implement cmd-k cmd-d to replace selection with next 2021-11-25 13:39:08 -07:00
Nathan Sobo d249618ee6 Improve range-based selection queries to only resolve the requested selections 2021-11-25 13:19:49 -07:00
Nathan Sobo c47855424f Merge pull request #250 from zed-industries/go-to-line
Implement go-to-line interface
2021-11-24 17:15:52 -07:00
Nathan Sobo f7532c785e Render the current line, column, and line count in go to line dialog 2021-11-24 16:52:18 -07:00
Nathan Sobo a07fe3aa58 Improve styling of the go to line modal 2021-11-24 16:16:29 -07:00
Nathan Sobo 1e49b56626 Restore scroll position and selections when cancelling go-to-line
But preserve the line when confirming.
2021-11-24 15:43:48 -07:00
Nathan Sobo 8c0541b455 Fix warnings 2021-11-24 15:24:27 -07:00
Nathan Sobo 0854976691 Highlight the selected line when typing in the go to line dialog 2021-11-24 15:23:45 -07:00
Nathan Sobo 2b9db911c7 WIP 2021-11-24 09:18:41 +01:00
Nathan Sobo e0bf5337ca Merge pull request #244 from zed-industries/mouse-selections
Improve support for selecting text via the mouse
2021-11-23 18:11:04 -07:00
Nathan Sobo bfecdb7bc0 Remove newest selection when adding a selection with a click count > 1
This prevents selections added in earlier clicks from being rendered under the pending selection.
2021-11-23 16:30:33 -07:00
Nathan Sobo 73afb29b04 Use alt modifier instead of cmd to add selections 2021-11-23 16:23:30 -07:00
Nathan Sobo 9e651ee127 Simplify handling of shift-click to extend selections 2021-11-23 16:03:21 -07:00
Nathan Sobo d969f38850 Implement shift-click to extend the newest selection 2021-11-23 15:42:21 -07:00
Nathan Sobo 843972ceca Merge pull request #232 from zed-industries/uniform-bias
Use uniform biases in AnchorMap, AnchorRangeMap
2021-11-22 15:55:03 -07:00
Nathan Sobo 68223bdb67 Place the cursor at end of first line when splitting selections into lines 2021-11-22 15:53:37 -07:00
Nathan Sobo 2f39dee28b Use uniform biases in AnchorMap, AnchorRangeMap
Specifying a different bias for every point makes the interface feel pretty unwieldy and we don't really use it.
2021-11-22 15:30:46 -07:00
Nathan SoboandMax Brunsfeld 213aa36e1c WIP: Track down bugs with longest_row on wrap map
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-17 19:45:56 -07:00
Nathan SoboandMax Brunsfeld c5956a0363 Start at the end of the last transform when catching up to edits during wrapping
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-17 19:44:17 -07:00
Nathan SoboandMax Brunsfeld 18354c5e04 Hack in show next diagnostic command
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-16 16:51:38 -08:00
Nathan SoboandMax Brunsfeld 52a4c15c14 Eliminate non-highlighted chunks APIs
Now we only have a single code path for chunks across all layers, but highlighting is optional and controlled by a flag.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-16 16:51:38 -08:00
Nathan Sobo 7dd9b9539e WIP 2021-11-16 13:19:04 -07:00
Nathan SoboandMax Brunsfeld 092689ed56 WIP
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-16 13:10:06 -07:00
880b3f087f Insert empty isomorphic transforms on empty lines
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-11-16 12:14:00 -07:00
Nathan SoboandMax Brunsfeld 7d1ba6455b Implement BlockMapWriter::remove
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-15 17:09:26 -07:00
Nathan SoboandMax Brunsfeld 7b12c1c9e0 Enable soft wrap in randomized test of BlockMap
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-15 16:59:02 -07:00
Nathan SoboandMax Brunsfeld 862b988d56 Position blocks above/below buffer lines, even when the anchored line is soft-wrapped
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-15 16:45:51 -07:00
Nathan Sobo 3154ccbafe WIP 2021-11-14 16:24:40 -07:00
Nathan Sobo e644c0876e WIP: Start moving BlockMap to a 2d indexing scheme 2021-11-14 08:29:41 -07:00
Nathan Sobo 5832153712 Hack: Synthesize a newline before blocks below the last line of the buffer 2021-11-14 07:43:35 -07:00
Nathan Sobo b6e6dafca7 Account for trailing below blocks in BlockSnapshot::max_point 2021-11-13 19:50:42 -07:00
Nathan Sobo d6bc05cad0 Fix BlockMap unit test by skipping below blocks when advancing transforms 2021-11-13 18:19:21 -07:00
Nathan Sobo c9cbeafc05 Start on BlockSnapshot::clip_point
Not sure it works yet. Ran into another failure in the unit tests.
2021-11-13 17:44:09 -07:00
Nathan SoboandMax Brunsfeld e605a5ead2 Sketch an initial implementation for block_map::HighlightedChunks
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-12 14:51:25 -07:00
Nathan Sobo 068aa1adb3 WIP 2021-11-12 00:20:39 -07:00