Commit Graph
197 Commits
Author SHA1 Message Date
Julia 2149c17a0a Merge pull request #1768 from zed-industries/git-gutter-meets-code-folding
Git gutter meets code folding (and word wrap fixes)
2022-10-17 14:51:47 -04:00
Julia 9c47325c25 Use correct range to get diff hunks in the presence of wrapped lines 2022-10-13 13:52:44 -04:00
Max Brunsfeld 6cdf4e98fc Re-export basic text types from text and language crates
Also avoid production dependencies on fs and rope in collab
2022-10-12 15:48:19 -07:00
Mikayla Maki 0beb97547e Finished refactoring out fs and rope 2022-10-11 15:25:54 -07:00
Julia b18dd8fcff Fully qualify outside git-related code when a diff is a git diff 2022-09-29 13:16:02 -04:00
JuliaandMax Brunsfeld 883d5b7a08 Update git gutter status after debounced delay
Co-authored-by: Max Brunsfeld <max@zed.com>
2022-09-29 13:16:02 -04:00
ForLoveOfCatsandMikayla 8ba2f77148 One big cleanup pass of clippy lints
Co-authored-by: Mikayla <mikayla@zed.dev>
2022-08-10 16:51:01 -07:00
Antonio Scandurra 3174b08082 Update old snapshot when only the tab size changes 2022-08-03 12:23:02 +02:00
Antonio Scandurra 1e94eb74f4 Don't ignore new tab snapshot in WrapMap if only tab size changed 2022-08-03 12:16:46 +02:00
Antonio Scandurra d1f155337f Recompute layers above tab map entirely when tab size changes
Previously, we wouldn't generate any `TabEdit` when the tab size
changed, causing coordinate spaces in `WrapMap` and `BlockMap` to
become outdated.

This commit generates a synthetic edit that covers the entire `TabMap`
to ensure layers above are synchronized.
2022-08-03 11:06:17 +02:00
Max BrunsfeldandMikayla Maki fa5af4383d Introduce AutoindentMode parameter to Buffer::edit
This controls whether or not we preserve the relative indentation
of inserted text blocks.

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>
2022-07-28 14:03:31 -07:00
Antonio Scandurra 32662b6b92 Start indexing UTF-16 offsets
This is needed because cocoa will report ranges as UTF-16 indices.
2022-07-21 09:40:48 +02:00
Keith Simmons 755636d10e Use NonZeroU32 to ensure settings tabsize cannot be zero 2022-06-23 12:55:38 -07:00
Antonio Scandurra 6f7a893ec9 Determine Buffer::is_dirty based on the rope's fingerprint 2022-06-17 12:38:25 +02:00
Antonio Scandurra c31a233aad Introduce a new fingerprint field to TextSummary
This is calculated in `Rope` and uses the `bromberg_sl2` homomorphic
hash function to determine the fingerprint of a single chunk and
compose each chunk fingerprint into a single fingerprint for the entire
rope that is equivalent to hashing all the rope's bytes at once.
2022-06-17 12:12:37 +02:00
Antonio Scandurra 666ea61dbc Introduce a new BlockStyle field for blocks
This new field allows blocks to specify how they want to be laid out:

- If `Fixed` they can take up all the width they want and they will impact
the scroll width of the editor. This is useful for diagnostic messages and
allows scrolling the editor further to the right to visualize the entire message.
- If `Flex` they can extend all the way to the scroll width without impacting it
any further. This is useful for the rename editor that we insert as a block
decoration when hitting `F2`.
- If `Sticky`, they will be as wide as the editor element and won't participate
in the horizontal scrolling of the editor. This is useful for headers in general,
where we want e.g. the filename and the jump button to always be visible
independently of how much the user has scrolled to the right.
2022-06-10 13:47:40 +02:00
Keith Simmons 1da1853a76 Hide hover when font changes, and handle case where delay was preventing hover with large symbol range 2022-06-09 17:03:44 -07:00
Antonio Scandurra 712d47d94f Render a "Jump to Buffer" icon on all excerpt headers 2022-06-08 15:31:29 +02:00
Antonio Scandurra eda569d6b2 Snapshot file instead of path when creating a buffer snapshot 2022-06-08 14:29:14 +02:00
Antonio Scandurra ffb75b0f02 Extract an ExcerptRange containing a context field in multi_buffer
This lays the groundwork for adding an optional `primary` field that can
be supplied to provide the "jump to" feature.
2022-06-08 12:13:04 +02:00
Antonio Scandurra aefdde66a6 Pass a &mut BlockContext when rendering blocks
This wraps and derefs to `RenderContext<Editor>`, so that we can
easily use `MouseEventHandler`s in blocks.
2022-05-31 15:50:34 +02:00
Antonio Scandurra c0bf4a5bfd Bump FoldSnapshot version if excerpt gets edited outside of its bounds
This will cause layers above `FoldMap` to grab a fresh snapshot of the `FoldMap`
and, as a result, of the underlying `MultiBufferSnapshot`. It is a necessary change
because, even though the coordinate space is not affected, a buffer edit taking place
*before* an excerpt range could cause the excerpt buffer rows to change, e.g. if
lines were added or removed. This manifested itself in a randomized test.
2022-05-18 10:13:18 +02:00
Keith Simmons b4b61b4bbc Consolidate edit and edit_batched functions 2022-04-28 16:52:04 -07:00
Keith Simmons 04fc1d5982 Building, but failing test WIP 2022-04-27 17:25:38 -07:00
Antonio Scandurra 6d33697e82 Fix warning 2022-04-14 13:03:46 +02:00
Antonio Scandurra 1a1d670104 Speed up WrapSnapshot::line_len using the indexed transforms 2022-04-14 13:01:29 +02:00
Antonio Scandurra 91d4c835ad Introduce TabMap::line_len 2022-04-14 12:55:33 +02:00
Keith SimmonsandMax Brunsfeld 67b15ee037 Use language specific tabsize in editor commands
Co-authored-by: Max Brunsfeld <max@zed.dev>
2022-04-06 15:10:29 -07:00
Keith Simmons 1812480cbb Tab size is pulled properly from settings instead of hardcoded 2022-04-06 10:23:37 -07:00
Nathan Sobo 2c232d585a Merge branch 'main' into unfold-on-select-match 2022-03-24 14:13:27 -06:00
Keith SimmonsandNathan Sobo 92c7b5d6ef Remove result from anchor cmp functions
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-03-24 11:48:31 -07:00
Antonio Scandurra 1c25b3d150 Test the new inclusive parameter when unfolding 2022-03-24 17:20:28 +01:00
Antonio Scandurra 4f50da759a Allow customizing whether FoldMap::unfold treats ranges as inclusive 2022-03-24 17:14:41 +01:00
Max BrunsfeldandKeith Simmons ff4bdb3114 Fix incorrect highlighting when an empty range is highlighted via the DisplayMap
Co-Authored-By: Keith Simmons <keith@zed.dev>
2022-03-23 18:20:55 -07:00
Antonio ScandurraandNathan Sobo 7155dabf5b Fade out unnecessary code
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-15 15:51:59 +01:00
Antonio ScandurraandNathan Sobo a6d0caf557 Don't seek FilterCursor upon creation
This lets us use `next` or `prev` to decide whether to park the cursor
at the first or last filtered item.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-15 15:13:23 +01:00
Nathan Sobo 33bcd6d904 Merge remote-tracking branch 'origin/main' into select-on-rename 2022-03-12 10:10:23 -07:00
Nathan Sobo 951fd1ab36 Merge branch 'main' into select-on-rename 2022-03-11 15:30:07 -07:00
Antonio Scandurra c67cfd7fe1 Respect excerpt's range when comparing two anchors both belonging to it 2022-03-11 12:42:22 +01:00
Nathan Sobo e6b1fea117 WIP 2022-03-10 11:32:14 -07:00
Nathan Sobo ac1eb19f83 Start on text highlight support 2022-03-09 20:51:35 -07:00
Nathan Sobo 49e38e6e00 Eliminate ToFoldPoint trait
Just make it a method on FoldMap
2022-03-09 20:49:18 -07:00
Antonio Scandurra 466db69780 Pass a reference to TestAppContext in tests
This allows us to drop the context *after* we ran all futures to
completion and that's crucial otherwise we'll never drop entities
and/or flush effects.
2022-03-01 12:01:02 +01:00
Max Brunsfeld 1ee15e1a59 Add and remove excerpts in randomized FoldMap and WrapMap tests 2022-02-09 14:43:24 -08:00
Max Brunsfeld 5b4c0d64bc Get tests passing and project diagnostics view working w/ new excerpt headers 2022-02-09 13:51:52 -08:00
Max Brunsfeld 3d9c39d0eb Silence warnings 2022-02-09 13:00:09 -08:00
fc70c6d4fd Fix BlockMap's handling of trailing empty excerpt updates with other edits
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-09 11:54:59 -08:00
cbf59ffafb Handle replacing trailing empty excerpt with another empty excerpt
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-02-09 19:38:18 +01:00
fab6f0c568 Add/remove excerpts in BlockMap randomized tests and fix resulting errors
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-02-09 19:10:13 +01:00
Antonio ScandurraandNathan Sobo 8d95dbe3e6 Render path headers in editor element
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-09 16:28:18 +01:00