Commit Graph
48 Commits
Author SHA1 Message Date
Antonio Scandurra db9cfb0d2b Highlight active lines 2021-07-30 09:50:28 -07:00
Antonio Scandurra 3abed88c76 Highlight active row(s) in the gutter 2021-07-30 09:50:28 -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 e7d03af942 Fix moving to previous word across a wrap boundary
I'm just going to the end of the soft-wrapped line, mirroring the behavior with hard wraps. It's maybe not perfectly technically correct but that behavior would require us to consider word boundaries outside of the current line, which doesn't seem worth the complexity.
2021-07-30 09:50:28 -07:00
Max Brunsfeld 25c472acd0 WIP - unit test for word-wise movement w/ soft wrap 2021-07-30 09:50:28 -07:00
Nathan SoboandAntonio Scandurra c779633154 Make unfolding inclusive
If the range *touches* the fold, we unfold. This was needed to fix the behavior for unfolding at the current selection position. Previously, there was some kind of translation issue that was allowing us to accidentally work the way we wanted without this.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-07-30 09:50:28 -07:00
Nathan SoboandAntonio Scandurra a6a8f4fd81 Introduce a struct for spanned_rows result
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-07-30 09:50:28 -07:00
Nathan SoboandAntonio Scandurra 029460bf7e Respect buffer row boundaries in line-oriented edit operations
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-07-30 09:50:28 -07:00
Max Brunsfeld 05f8a61bc8 Add a bias parameter when converting buffer points to fold points 2021-07-30 09:50:28 -07:00
Nathan Sobo 613192974f Don't render line numbers for soft-wrapped line segments 2021-07-30 09:50:28 -07:00
Nathan Sobo 7a5f1b5446 Preserve logical scroll position when wrap width changes 2021-07-30 09:50:28 -07:00
Antonio ScandurraandNathan Sobo 3d07be34f8 Remove unnecessary Mutex from scroll-related state in Editor
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-30 09:50:28 -07:00
Max BrunsfeldandNathan Sobo dd6820e714 Avoid crashes from trying to lay out too large of lines
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-26 11:28:05 -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
Antonio Scandurra 623d574b51 Fix mistakenly moved line in beginning/end of line editor tests 2021-07-26 12:11:22 +02:00
Nathan Sobo da50576129 Fix remaining errors and warnings 2021-07-25 07:56:53 -06:00
Nathan Sobo 9edc8b9a06 WIP 2021-07-24 08:40:48 -06:00
Nathan Sobo 3bf47be51e WIP 2021-07-24 08:09:04 -06:00
Nathan Sobo f81f043058 WIP 2021-07-23 12:25:09 -06:00
Max BrunsfeldandNathan Sobo 5d22c6c4bd Start restructuring WrapMap with simpler concurrency
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-22 16:21:42 -07:00
Nathan Sobo f169f8e358 Ensure that soft wrapped lines don't cause horizontal scrolling 2021-07-21 12:27:01 -06:00
Max BrunsfeldandNathan Sobo 72fdd3fb9a Start rendering highlighted text and line numbers via the wrap map
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-20 18:03:02 -07:00
Max Brunsfeld 07e97e6cad wip 2021-07-20 15:30:50 -07:00
Max BrunsfeldandNathan Sobo 7832562675 Add WrapMap as a member of DisplayMap
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-20 13:03:59 -07:00
Max Brunsfeld f561f33aa9 Move DisplayMap's reading methods to DisplayMapSnapshot 2021-07-15 11:48:57 -07:00
Nathan SoboandMax Brunsfeld 2bde54971e Move all FoldMap query methods to FoldMapSnapshot
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-07-15 11:36:24 -06:00
Nathan Sobo 09afba9251 Introduce buffer::Content<'a> struct to share logic with buffer::Snapshot
We want to move a bunch of methods on FoldMap to fold_map::Snapshot. This captures a buffer snapshot, and we'll need a bunch of methods that currently are on Buffer to also be implemented on buffer::Snapshot. This Content reference struct will be a good zero-cost place to store that logic.
2021-07-15 09:50:50 -06:00
Max Brunsfeld eeebc761b6 Restructure Peer to handle connections' messages in order 2021-07-09 16:27:34 -07:00
Antonio Scandurra 569a4a1e2d WIP: Save remote buffers 2021-07-02 17:02:17 +02:00
Antonio ScandurraandNathan Sobo e95936c624 Fix memory leak of Editor due to blinking cursors
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-01 15:57:17 +02:00
Antonio Scandurra c881c7f30f Start on rendering remote selections 2021-07-01 11:21:43 +02:00
Nathan Sobo bbf803d7dc Store a reference to the LangageRegistry on the Worktree 2021-06-29 20:07:37 -06:00
34963ac80d Use entry_id on File instead of worktree::Diff to detect when buffers' files change
Rather than computing a diff after processing a batch of FSEvents, we instead detect renames as we're inserting entries. We store an entry_id on the File object that is owned by each buffer, and use this to detect when the path of the File has changed.

We now also manage all File-related state and event emission for Buffers in the LocalWorktree, since the logic will need to be totally different in the remote case.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-06-29 18:19:38 -06:00
Nathan Sobo b7a4393f29 Redesign Worktree save API and make test_rescan_simple pass
This commit does too much. The first goal was to change our approach to saving new buffers so that we don't need to construct a File for an entry that doesn't exist. Rather than doing that, we call `Worktree::save_buffer_as` with the buffer handle, the path, and the contents. This then saves the buffer and returns a handle to a `File` that references an entry that actually exists. I needed to do this so that we can store an entry id on `File`.

In the process, I noticed intermittent test failures on `test_rescan_simple`, so I made some changes required to fix those related to our reuse of existing ids. Our previous approach of removing a path when inserting a new entry was broken, because of the recursive nature of `remove_path`. Instead, I simply recycle the id of an existing worktree entry with the same path if one is present, then allow it to be replaced.
2021-06-28 19:05:38 -06:00
Antonio Scandurra e72b4ae03d Maintain active selections as editors are focused and blurred 2021-06-28 12:37:58 +02:00
Antonio Scandurra 0bc8663d36 Remove selection set when an editor is closed 2021-06-28 11:43:21 +02:00
Max Brunsfeld 60ee97be24 Always represent anchor as a versioned offset
Remove the `Start` and `End` variants, and always
use the structure that was previously called `Middle`.
This makes Anchors simpler to serialize and deserialize.
2021-06-25 17:02:48 -07:00
Max Brunsfeld 04c80578bc Start work on sending buffer operations 2021-06-25 13:46:36 -07:00
Nathan SoboandMax Brunsfeld c5e08b6548 Eagerly update worktree entries when saving
Don't use ModelHandles for storing Files.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-06-22 17:53:35 -07:00
Nathan SoboandMax Brunsfeld a364839e93 Replace FileHandle with File entity that subscribes to Worktree update events
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-06-21 20:40:40 -06:00
Antonio Scandurra e071d40058 Use a single Bias enum everywhere 2021-06-04 13:39:57 +02:00
9a29f55777 WIP: Re-implement apply_local_edit to look more like apply_remote_edit
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-06-03 19:32:54 +02:00
Antonio Scandurra 7f265230ea Fix tests 2021-05-31 16:51:33 +02:00
Antonio Scandurra 7c418313a7 Merge selections correctly when selecting larger syntax node
When running this command with multiple cursors, if one of them was at a
later position in the buffer but lying on a shallower node, it could
happen that its start could move prior to cursors that were before it
but lying on a deeper node.

This could cause the selection merging algorithm to mistakenly keep some
selections even if they overlapped. With this commit we now sort
selections prior to merging them in `Editor::select_larger_syntax_node`.
2021-05-31 16:33:26 +02:00
Nathan Sobo 081191917c Add more emacs-inspired bindings
Word-wise movement and columnar selection without reaching for the arrows.
2021-05-29 12:06:52 -06:00
Max Brunsfeld 5176f3deba Rename context parameters to cx in editor.rs 2021-05-28 14:56:38 -07:00
Max BrunsfeldandNathan Sobo 90f35546d3 Rename BufferView -> Editor
* BufferElement -> EditorElement

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-28 14:41:58 -07:00
Max BrunsfeldandNathan Sobo 139bcb8304 Rename foo/mod.rs files too foo.rs
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-05-28 14:41:58 -07:00