Max Brunsfeld
660bc0f2ff
Start work on allowing variables in themes
2021-07-30 17:28:22 -07:00
Max Brunsfeld
e5b3aa8be5
Merge pull request #122 from zed-industries/deterministic-random-synchronous-tests
...
Use deterministic executor in randomized synchronous tests
2021-07-30 14:16:05 -07:00
Max Brunsfeld
ed15275a88
Use deterministic executor in randomized synchronous tests
...
Remove App::test function
2021-07-30 14:07:37 -07:00
Max Brunsfeld
a53b742b4e
Fix type of Workspace::open_new_file context parameter
...
Fixes #118
2021-07-30 10:11:46 -07:00
Max Brunsfeld
6871ae3794
Specify zed as the workspace's default member
...
This way, `cargo run` at the root of the repo will run the Zed app
instead of the server.
2021-07-30 10:00:04 -07:00
Antonio Scandurra
392e8b76ba
Don't mark the first row as soft-wrapped when the tree is empty
...
Also, add a randomized test to verify that soft-wrapped rows are
reported correctly.
2021-07-30 09:50:28 -07:00
Antonio Scandurra
3a839fd072
Highlight active lines
2021-07-30 09:50:28 -07:00
Antonio Scandurra
7e18bba1ac
Highlight active row(s) in the gutter
2021-07-30 09:50:28 -07:00
Max Brunsfeld
85fdc91e47
Extract most colors in codebase into theme file. switch to dark
2021-07-30 09:50:28 -07:00
Nathan Sobo and Max Brunsfeld
e65ad6fe16
Allow more time wrapping to complete synchronously
...
We're seeing occasional flickers and wondering if this will help.
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com >
2021-07-30 09:50:28 -07:00
Nathan Sobo
2893aa6905
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
6b3ff608a8
WIP - unit test for word-wise movement w/ soft wrap
2021-07-30 09:50:28 -07:00
Nathan Sobo and Max Brunsfeld
0f5010d4e1
Add some incomplete tests for movement
...
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com >
2021-07-30 09:50:28 -07:00
Nathan Sobo and Antonio Scandurra
400a1e05c3
Fix movement across soft wrap boundaries
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com >
2021-07-30 09:50:28 -07:00
Nathan Sobo and Antonio Scandurra
25686779a7
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 Sobo and Antonio Scandurra
77d8ddc185
Only honor rightward bias for buffer points *inside* of folds
...
(Not at boundaries)
Co-Authored-By: Antonio Scandurra <me@as-cii.com >
2021-07-30 09:50:28 -07:00
Nathan Sobo and Antonio Scandurra
dcdb1622a4
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 Sobo and Antonio Scandurra
a33aea85a1
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
Nathan Sobo and Antonio Scandurra
74fc71c901
Don't let people retry randomized tests
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com >
2021-07-30 09:50:28 -07:00
Nathan Sobo and Antonio Scandurra
b6e235be86
Reuse FontCache across randomized tests
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com >
2021-07-30 09:50:28 -07:00
Nathan Sobo and Antonio Scandurra
731d86616c
Report the end of the current row rather than the start of the next
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com >
2021-07-30 09:50:28 -07:00
Max Brunsfeld and Nathan Sobo
a88668b83b
Fix bugs in {prev,next}_row_boundary
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-07-30 09:50:28 -07:00
Max Brunsfeld
0587862118
Add a bias parameter when converting buffer points to fold points
2021-07-30 09:50:28 -07:00
Max Brunsfeld and Nathan Sobo
fdeab5c15e
Add randomized test for DisplayMap
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-07-30 09:50:28 -07:00
Antonio Scandurra
f9d13d741f
WIP
2021-07-30 09:50:28 -07:00
Max Brunsfeld and Antonio Scandurra
5f4d6eb3cc
Parse randomized test env vars at runtime
...
Co-Authored-By: Antonio Scandurra <me@as-cii.com >
2021-07-30 09:50:28 -07:00
9f5ccea874
Setup randomized test harness in gpui::test
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
Co-Authored-By: Max Brunsfeld <max@zed.dev >
2021-07-30 09:50:28 -07:00
Antonio Scandurra and Nathan Sobo
6d645c3ff5
Allow passing iterations and seed as env variables
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-07-30 09:50:28 -07:00
Antonio Scandurra
7ac909a65b
Move buffer rows test into WrapMap randomized test
...
Also, change the way we assert on buffer rows to reflect the fact
that we will still show the line as soft-wrapped when there is a
fold that spans multiple buffer rows.
2021-07-30 09:50:28 -07:00
Antonio Scandurra
4cd013069f
Use a uniform distribution for generating random characters
2021-07-30 09:50:28 -07:00
Antonio Scandurra
e8b23fd5cc
Expand edits correctly when there are folds or multi-byte chars
...
Previously, we were mistakenly adding `tab_size` to the extent
produced by the fold edits but that could cause the edit to land on
a multi-byte character (like a fold or an emoji).
In practice, we only need to expand the edit's extent by 1 because
we are operating in the fold coordinate space and all we need to
convey is that we want to encapsulate the first tab next to whatever
edit has just occurred in the `FoldMap`.
2021-07-30 09:50:28 -07:00
Antonio Scandurra
1339c11f78
Add fold mutations to randomized test for WrapMap
2021-07-30 09:50:28 -07:00
Nathan Sobo
f0689f3507
Don't render line numbers for soft-wrapped line segments
2021-07-30 09:50:28 -07:00
Nathan Sobo
6529e88a73
Clip left when moving cursor to end of line
...
This ensures we stay on the same line when the current display line ends with a soft wrap.
2021-07-30 09:50:28 -07:00
Nathan Sobo
aa128b8015
Clip left when moving vertically
2021-07-30 09:50:28 -07:00
Nathan Sobo
ce99100ef1
Preserve logical scroll position when wrap width changes
2021-07-30 09:50:28 -07:00
Antonio Scandurra and Nathan Sobo
a1b2bf4580
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
Antonio Scandurra and Nathan Sobo
756718034e
Fix outdated test assertions after changing wrapping behavior
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-07-30 09:50:28 -07:00
Antonio Scandurra and Nathan Sobo
36a91ad31e
Preserve indentation when soft-wrapping
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-07-30 09:50:28 -07:00
Antonio Scandurra
695484b323
Use LineWrapper in a thread-local fashion
...
This removes the critical section from a hot code path, yielding a 2x
speedup to rewrap an entire file.
2021-07-30 09:50:28 -07:00
Max Brunsfeld and Nathan Sobo
5c1cec90a5
Avoid allocation in LineWrapper::wrap_line
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-07-30 09:50:28 -07:00
Max Brunsfeld and Nathan Sobo
9ee34148a8
🐎 Avoid SumTree::update_last when wrapping lines
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-07-30 09:50:16 -07:00
Antonio Scandurra
7ef3bd9d7b
Fix panic when fuzzy-matching on a Worktree that contains no files
...
As part of our work on the deterministic executor, in bf172f2 we fixed a
bug that occurred when there were more CPUs than paths to fuzzy-match
on.
However, that introduced another bug that caused Zed to panic when
trying to calculate how many paths should be fuzzy-matched by each
available worker thread for worktrees that didn't contain any file.
This commit bails out early in `fuzzy::match_paths` if the vector of
paths to search is empty.
2021-07-30 09:50:02 -07:00
Max Brunsfeld and Nathan Sobo
25a4af1848
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
1a0ade38e2
Store pending edits until applying them to a non-interpolated snapshot
2021-07-26 17:17:07 +02:00
Antonio Scandurra
35bf09e22c
Change wrap width in randomized test and fix discovered bugs
2021-07-26 15:38:24 +02:00
Antonio Scandurra
13b4b49385
Fix unused variable warning
2021-07-26 13:03:43 +02:00
Antonio Scandurra
8b6a9c5046
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
cede1a0836
Set snapshot in the foreground after recomputing it in the background
2021-07-26 12:11:48 +02:00
Antonio Scandurra
1b6d1f68a0
Fix mistakenly moved line in beginning/end of line editor tests
2021-07-26 12:11:22 +02:00