Commit Graph

2060 Commits

Author SHA1 Message Date
Antonio Scandurra
dc81b5f57a Make remote edit randomized tests pass with locators 2021-12-09 09:15:19 +01:00
Antonio Scandurra
b4ebe179f9 Make local edit randomized tests pass with locators 2021-12-09 09:11:16 +01: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
Max Brunsfeld
bd6e972d0f
Merge pull request #281 from zed-industries/fix-release-asset-redirects
Don't pass GH auth header when following redirects for release assets
2021-12-07 12:49:49 -08:00
Max Brunsfeld
6d9bf802e2 Don't pass GH auth header when following redirects for release assets 2021-12-07 12:34:55 -08:00
Antonio Scandurra
703e8e626d
Merge pull request #276 from zed-industries/markdown
Add basic markdown highlighting
2021-12-06 08:43:10 +01:00
Max Brunsfeld
b1ed9c88a4 Add tree-sitter-markdown, set up simple markdown higlighting 2021-12-05 21:37:31 -08:00
Max Brunsfeld
026c3476db Upgrade tree-sitter to 0.20.1 2021-12-05 21:37:08 -08:00
Antonio Scandurra
a13e2518b8
Merge pull request #275 from zed-industries/fix-selection-artifacts
Use 16-bit float to store path windings
2021-12-05 12:58:00 +01:00
Antonio Scandurra
45d1690f6e Use 16-bit float to store path windings
Previously, we were using a normalized 8-bit unsigned integer which forced us
to represent each increment of the winding number as a fraction of the max
value (1 / 255) which we would then add up using additive alpha blending.

This had three major drawbacks:

- The max winding number could not be greater than 255.
- Adding up (1 / 255) several times could result in a loss of precision.
- Due to also computing anti-aliasing as a fractional winding number, we had to
  reduce the max winding number to 32. This was still not good enough because
  we would multiply a fractional value with `1 / 32`, thus introducing more and
  more loss of precision.

This commit changes the texture type to an `f16` which doesn't require the
division by 255 and enables greater precision in the computation of the
anti-aliased parts of a curve. Note how this also removes the limitation of 255
windings at most per curve. The tradeoff is paying twice as much memory for
storing the texture, but that seems totally valid to achieve rendering accuracy.

Note that this kind of texture should be compatible with WebGL2 once we start
working on a web version of Zed.
2021-12-05 11:17:26 +01:00
Antonio Scandurra
3426d46b69 Clear pending keystrokes after dispatching an action
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-03 17:59:46 +01:00
Antonio Scandurra
0e93bc41dd In add_option_view, avoid bumping view's ref counts if view is None
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-03 17:52:39 +01:00
Max Brunsfeld
bd573e0651
Merge pull request #273 from zed-industries/flexible-blocks
Render blocks as arbitrary elements
2021-12-01 17:18:45 -08:00
Nathan Sobo
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 Sobo
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 Sobo
512a10b037 Use new BlockMap API to render diagnostics
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-12-01 17:22:40 -07:00
Max Brunsfeld
0c714210ff Start work on generalizing the BlockMap to allow arbitrary elements
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-01 15:25:55 -08:00
Antonio Scandurra
e668ff8bcd Avoid allocating a Patch just to check if there are no edits
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-01 16:47:04 +01:00
Antonio Scandurra
853b636435
Merge pull request #272 from zed-industries/fold-map-edits
Don't rely on `Buffer::edits_since` to keep `FoldMap` up-to-date
2021-12-01 16:42:34 +01:00
Antonio Scandurra
733e0cb21b Use the new buffer subscription API to keep DisplayMap in sync
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-01 16:08:53 +01:00
Antonio Scandurra
3b536f153f Introduce text::Buffer::subscribe
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-12-01 15:55:05 +01:00
Antonio Scandurra
47c467dafc Bump FoldMap's version in FoldMap::sync (and not in DisplayMap) 2021-12-01 12:05:02 +01:00
Antonio Scandurra
b841b3eb79 Don't produce invalid intermediate edits in Patch::compose 2021-12-01 11:44:33 +01:00
Max Brunsfeld
faba276fdc WIP - maintain foldmap with Buffer::edits_since
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-30 17:23:02 -08:00
Max Brunsfeld
2463077b2d
Merge pull request #269 from zed-industries/simplify-buffer-content
Use `&'a Snapshot` directly instead of `impl Into<Content<'a>>`
2021-11-30 13:48:15 -08:00
Max Brunsfeld
924e1578ea Use &Snapshot directly instead of impl Into<Content<'a>>
The text::Buffer and its snapshot already used the same representation
for their content, so we can just make Buffer deref to a Snapshot.
2021-11-30 13:32:11 -08:00
Max Brunsfeld
36546463e6
Merge pull request #268 from zed-industries/improve-file-navigation
Improve file navigation by naming the root of every crate after the crate itself
2021-11-30 12:04:07 -08:00
Nathan Sobo
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 Sobo
748b1ba602 Fix warning
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-11-30 12:27:00 -07:00
Nathan Sobo
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 Sobo
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
Antonio Scandurra
fcbd7f9a5a
Merge pull request #266 from zed-industries/fix-go-to-line
Use display coordinates for the highlighted row in "go to line"
2021-11-30 11:55:00 +01:00
Antonio Scandurra
2449834868 Use display coordinates for the highlighted row in "go to line" 2021-11-30 11:40:53 +01: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 Sobo
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
Max Brunsfeld
1a91aa8194 Introduce a collections crate w/ deterministic hashmap, hashset in tests
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-29 15:22:45 -08:00
Max Brunsfeld
5ec003530f Consolidate pending effects logic into MutableAppContext::update
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-29 14:16:19 -08:00
Max Brunsfeld
4cc1556ca4 Introduce weak_handle methods on ModelContext and ViewContext
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-29 14:13:22 -08:00
Max Brunsfeld
29b616f4cc
Merge pull request #263 from zed-industries/fix-highlighting-when-x-scrolled
Paint highlighted lines correctly when horizontally scrolled
2021-11-29 11:43:08 -08:00
Max Brunsfeld
88e0fe6f88 Paint highlighted lines correctly when horizontally scrolled 2021-11-29 11:28:43 -08:00
Max Brunsfeld
7537c3b6d4
Merge pull request #261 from zed-industries/setting-overrides
Override soft-wrap settings for Markdown and Plain Text
2021-11-29 11:12:40 -08:00
Antonio Scandurra
1803bd77ef Fix test assertions 2021-11-29 18:15:03 +01:00
Antonio Scandurra
9d7039ed51 Embed a plain text grammar and override settings for that too 2021-11-29 18:01:51 +01:00
Antonio Scandurra
2c17ae9aa6 Introduce a new Grammar struct and allow it to be optional
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-29 17:38:59 +01:00
Antonio Scandurra
b9edde7b26 Make settings fields that can be overridden private
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-11-29 17:08:43 +01:00
Antonio Scandurra
cc78ae14d4 Add a sample markdown grammar to honor the new soft wrap override 2021-11-29 09:39:16 +01:00
Antonio Scandurra
93de2bcfed Allow overriding editor settings on a per-language basis 2021-11-29 09:39:13 +01:00