Commit Graph
197 Commits
Author SHA1 Message Date
Julia a2e05e3a47 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 7abe6bfd4a Use correct range to get diff hunks in the presence of wrapped lines 2022-10-13 13:52:44 -04:00
Max Brunsfeld a2c9a67558 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 a9ce687031 Finished refactoring out fs and rope 2022-10-11 15:25:54 -07:00
Julia 3eadb80c9a Fully qualify outside git-related code when a diff is a git diff 2022-09-29 13:16:02 -04:00
JuliaandMax Brunsfeld 26464ad25b Update git gutter status after debounced delay
Co-authored-by: Max Brunsfeld <max@zed.com>
2022-09-29 13:16:02 -04:00
ForLoveOfCatsandMikayla fbea44bc5c One big cleanup pass of clippy lints
Co-authored-by: Mikayla <mikayla@zed.dev>
2022-08-10 16:51:01 -07:00
Antonio Scandurra 1c7f03f20b Update old snapshot when only the tab size changes 2022-08-03 12:23:02 +02:00
Antonio Scandurra 4af30921d9 Don't ignore new tab snapshot in WrapMap if only tab size changed 2022-08-03 12:16:46 +02:00
Antonio Scandurra 39ef29fb40 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 669d716519 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 d103825bc6 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 5c67560264 Use NonZeroU32 to ensure settings tabsize cannot be zero 2022-06-23 12:55:38 -07:00
Antonio Scandurra 5ad9e9e6c8 Determine Buffer::is_dirty based on the rope's fingerprint 2022-06-17 12:38:25 +02:00
Antonio Scandurra 4d65ad3543 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 d467da1afc 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 6cbb582c48 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 96602c79bc Render a "Jump to Buffer" icon on all excerpt headers 2022-06-08 15:31:29 +02:00
Antonio Scandurra 19047bd204 Snapshot file instead of path when creating a buffer snapshot 2022-06-08 14:29:14 +02:00
Antonio Scandurra cbbdef5434 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 0b765ebdc6 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 65d11f89f4 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 47d4f42467 Consolidate edit and edit_batched functions 2022-04-28 16:52:04 -07:00
Keith Simmons 5051769dd3 Building, but failing test WIP 2022-04-27 17:25:38 -07:00
Antonio Scandurra 4fb8fff645 Fix warning 2022-04-14 13:03:46 +02:00
Antonio Scandurra 33d3501d8c Speed up WrapSnapshot::line_len using the indexed transforms 2022-04-14 13:01:29 +02:00
Antonio Scandurra bd4271d466 Introduce TabMap::line_len 2022-04-14 12:55:33 +02:00
Keith SimmonsandMax Brunsfeld 33a33439de 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 b6f15ecc50 Tab size is pulled properly from settings instead of hardcoded 2022-04-06 10:23:37 -07:00
Nathan Sobo 28251eba43 Merge branch 'main' into unfold-on-select-match 2022-03-24 14:13:27 -06:00
Keith SimmonsandNathan Sobo 1eacdcf00a Remove result from anchor cmp functions
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-03-24 11:48:31 -07:00
Antonio Scandurra d980cab5d9 Test the new inclusive parameter when unfolding 2022-03-24 17:20:28 +01:00
Antonio Scandurra 3f8b9684ce Allow customizing whether FoldMap::unfold treats ranges as inclusive 2022-03-24 17:14:41 +01:00
Max BrunsfeldandKeith Simmons f64c214207 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 1816b44648 Fade out unnecessary code
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-15 15:51:59 +01:00
Antonio ScandurraandNathan Sobo 3217629af3 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 ea7f2b309d Merge remote-tracking branch 'origin/main' into select-on-rename 2022-03-12 10:10:23 -07:00
Nathan Sobo 2c6d8e9d65 Merge branch 'main' into select-on-rename 2022-03-11 15:30:07 -07:00
Antonio Scandurra 092abbe39b Respect excerpt's range when comparing two anchors both belonging to it 2022-03-11 12:42:22 +01:00
Nathan Sobo 1e76d109a3 WIP 2022-03-10 11:32:14 -07:00
Nathan Sobo 150fdc71af Start on text highlight support 2022-03-09 20:51:35 -07:00
Nathan Sobo 52eabf6231 Eliminate ToFoldPoint trait
Just make it a method on FoldMap
2022-03-09 20:49:18 -07:00
Antonio Scandurra 79568c471a 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 164b60941b Add and remove excerpts in randomized FoldMap and WrapMap tests 2022-02-09 14:43:24 -08:00
Max Brunsfeld ab8e3f8107 Get tests passing and project diagnostics view working w/ new excerpt headers 2022-02-09 13:51:52 -08:00
Max Brunsfeld 0be3b9e3be Silence warnings 2022-02-09 13:00:09 -08:00
bf162aee31 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
9f0e79b744 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
d81cbf2d48 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 f7fd68ef77 Render path headers in editor element
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-09 16:28:18 +01:00