Mikayla Maki
5356ec4730
Merge pull request #2287 from zed-industries/fix-fold-range-finding
...
Fix code folds with wraps
2023-03-17 17:18:56 -07:00
Mikayla Maki
eba119b914
Fix fold tests with new representation
...
Switch UI code from using display rows to using buffer rows
Make folds only show up on lines with line layouts
co-authored-by: Max <max@zed.dev>
2023-03-17 16:00:22 -07:00
Antonio Scandurra
4d915f4530
Don't make fonts::Features
Copy
2023-03-17 13:54:56 +01:00
Antonio Scandurra
b2c733baab
WIP: Allow specifying font features in the editor
...
This just lays the foundation for threading through a `fonts::Features`
struct, but it's not used yet.
2023-03-17 09:51:36 +01:00
Mikayla Maki
75bea91245
Convert code folding to be in terms of buffer points instead of display points
...
Co-authored-by: max <max@zed.dev>
2023-03-14 16:48:03 -07:00
Mikayla Maki
606d683f29
Add interactable fold markers
...
Change fold handlers to be driven by the fold map
Switch to a mouse region based implementation for click regions
Co-authored-by: Max <max@zed.dev>
2023-03-03 12:26:36 -08:00
Mikayla Maki
6cf62a5b02
Update tests to use new fold indicator
2023-02-28 17:17:29 -08:00
Mikayla Maki
c397fd9a71
Added click regions and cursor styles
2023-02-28 16:34:28 -08:00
Max Brunsfeld
f71145bb32
Add a layer of indirection between excerpt ids and locators
2022-11-28 14:18:49 -08:00
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
Julia
883d5b7a08
Update git gutter status after debounced delay
...
Co-authored-by: Max Brunsfeld <max@zed.com>
2022-09-29 13:16:02 -04:00
ForLoveOfCats
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 Brunsfeld
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 Simmons
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 Simmons
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 Brunsfeld
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 Scandurra
7155dabf5b
Fade out unnecessary code
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-15 15:51:59 +01:00
Antonio Scandurra
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
Max Brunsfeld
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
Antonio Scandurra
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
Antonio Scandurra
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 Scandurra
8d95dbe3e6
Render path headers in editor element
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-09 16:28:18 +01:00
Antonio Scandurra
f1e3d5285b
Fix randomized test failures on BlockMap
with excerpt headers
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-09 15:17:40 +01:00
Antonio Scandurra
0e1318dfe4
WIP: Make editor
crate compile again
...
Tests are still failing though.
2022-02-09 11:09:11 +01:00
Max Brunsfeld
c7e2fae9cb
WIP - Add excerpt headers as a built-in feature of BlockMap
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-08 18:15:45 -08:00
Antonio Scandurra
ab26a175a4
Opt into language-aware features when getting buffer chunks
...
We use chunks a lot to transform points and sync the various display maps,
and always querying tree-sitter or the LSP diagnostics in those cases is
unnecessarily expensive.
2022-02-03 11:21:30 +01:00
Max Brunsfeld
88adddb324
Remove theme parameters from buffer/display map's chunks methods
...
Change Chunks to contain highlight ids instead of actual highlight
styles. Retrieve the actual highlight style from the theme in the
editor element layer.
This is to set us up to perform syntax highlighting in other code
paths where the theme is not available.
2022-02-02 16:33:04 -08:00
Max Brunsfeld
a890787923
Render header blocks as horizontall fixed (like the gutter)
...
Tweak editor layout to perform horizontal autoscroll before
laying out the blocks, so that they can access the scroll position.
2022-01-25 17:19:38 -08:00
Max Brunsfeld
cefb63936d
Tweak diagnostic header styling
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-25 15:33:49 -08:00
Nathan Sobo
0c6fd157ee
Scale diagnostic headers icons with editor font and right align w/ line numbers
...
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-01-25 12:40:53 -07:00
Max Brunsfeld
1a672929e0
Adjust BlockMap tests to reflect new tiebreaking behavior
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-12 12:11:55 -08:00
Max Brunsfeld
6ad9ff10c1
Ensure path headers appear before first diagnostic header
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-12 10:51:28 -08:00
Max Brunsfeld
b5ee095da9
Deduplicate path names in the project diagnostics view
2022-01-12 10:51:08 -08:00
Antonio Scandurra
0742640b39
Correctly report line boundaries when a map contains both folds and wraps
...
This fixes the randomized test failures that were occurring on main.
2022-01-10 11:26:48 +01:00
Nathan Sobo
d7a78e14ac
Allow disk-based diagnostic progress begin/end events to interleave
...
When multiple saves occur, we can have multiple start events followed by multiple end events. We don't want to update our project diagnostics view until all pending progress is finished.
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-01-06 09:32:08 -07:00
Nathan Sobo
6d6a82655a
Create blocks with anchors to allow a bias to be specified
...
This allows us to respect the bias on anchors we use to create excerpt headers so that they always remain above any content inserted at the start of an excerpt.
2021-12-30 01:03:19 -08:00
Nathan Sobo
7f786ca8a6
WIP: Start moving toward a simpler interface for detecting prev/next line boundaries
2021-12-27 22:11:05 -08:00
Max Brunsfeld
a86ba57983
Add Editor::remove_blocks
2021-12-22 17:30:14 -08:00
Antonio Scandurra
eec1748dc7
Render excerpt headers using DisplayMap::insert_blocks
...
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-12-21 18:32:27 +01:00
Antonio Scandurra
91c786a8db
WIP: Insert blocks in BlockMap
for MultiBuffer
headers
2021-12-21 17:38:03 +01:00
Max Brunsfeld
6444fcd442
Integrate MultiBuffer::buffer_rows into the display map
2021-12-16 13:53:32 -08:00
Antonio Scandurra
0fc2db6d6e
Account for folds when inserting/removing block decorations
2021-12-16 16:44:15 +01:00
Antonio Scandurra
de679cae78
Re-enable creating multiple blocks at once in BlockMap
tests
2021-12-16 12:41:48 +01:00
Antonio Scandurra
64e2f6d506
Ensure BlockMap::clip_point
always yield a valid buffer location
2021-12-16 12:29:37 +01:00
Antonio Scandurra
ec39c9d335
Allow specifying MAX_EXCERPTS
via an env variable in random tests
2021-12-16 12:28:54 +01:00
Max Brunsfeld
3e2f684545
Fix prev_row_boundary when a wrap follows a fold
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-15 18:30:09 -08:00
Max Brunsfeld
4c22774694
Always clip buffer points when clipping display points
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-15 17:58:24 -08:00
Max Brunsfeld
f898dc6dae
Guard against inverted ranges when building edits in unfold
...
The multibuffer lets you refer to offsets inside of headers,
so it's possible to create a fold that appears non-empty,
but which spans zero characters in the underlying buffers.
Fold ranges are biased inward: the start is biased right, and
the end is biased left.
Because of these two things, it's possible to create a fold
that becomes "inverted" when you insert text at that position.
2021-12-15 17:29:15 -08:00
Max Brunsfeld
cec0c5912c
Create multiple excerpts in random BlockMap test
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-15 10:21:11 -08:00
Antonio Scandurra
80abd84050
Create MultiBuffers with more than one fragment in more randomized tests
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2021-12-15 18:38:37 +01:00
Antonio Scandurra
5118f27a90
Overhaul MultiBuffer::chunks
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-15 17:22:04 +01:00
Antonio Scandurra
bcdb4ffd88
Allow edits at the end of MultiBuffer
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-15 16:45:01 +01:00
Antonio Scandurra
7bbaa1d930
Don't insert a newline after the last excerpt of a MultiBuffer
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-15 16:39:09 +01:00
Antonio Scandurra
ae0fa75abe
Start testing the integration of display layers with MultiBuffer
s
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-15 16:05:26 +01:00
Nathan Sobo
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 Sobo
c8b43e3078
Move multi_buffer to editor crate
2021-12-10 17:37:53 -07:00
Max Brunsfeld
a758bd4f8d
Fill in some missing methods on MultiBuffer, MultiBufferSnapshot
2021-12-10 14:27:04 -08:00
Antonio Scandurra
7524974f19
Get everything compiling again
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-10 17:15:16 +01:00
Nathan Sobo
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
Max Brunsfeld
5f8e406c18
Fill out ExcerptList API
...
This restores the improvements that we had made on the `project-diagnostics-generic` branch.
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-08 10:04:22 -08:00
Max Brunsfeld
6a44a7448e
Consolidate Edit types in editor crate
2021-12-08 09:33:55 -08:00
Max Brunsfeld
fa379885f1
Give more specific names to all snapshot and text iterator types
2021-12-08 09:24:00 -08: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