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
Antonio Scandurra
172f8d5b57
Remove remaining I/O nomenclature for DisplayMap coordinates
2021-07-26 11:19:36 +02:00
Antonio Scandurra
584b7a2319
Fix panic due to incorrectly calculating editor text size in layout
2021-07-26 11:04:22 +02:00
Nathan Sobo
8a91f57900
Eliminate input/output nomenclature from fold_map
...
Instead, just use FoldPoint, FoldOffset, etc. We don't need the naming to be general because we know exactly which layer we're building on at each layer of the DisplayMap.
2021-07-25 08:22:50 -06:00
Nathan Sobo
8444e9233e
Fix remaining errors and warnings
2021-07-25 07:56:53 -06:00
Nathan Sobo
0713c17a09
WIP
2021-07-24 08:40:48 -06:00
Nathan Sobo
eba5639048
WIP
2021-07-24 08:09:04 -06:00
Nathan Sobo
ed7e09f5b3
WIP
2021-07-23 12:25:09 -06:00
eb1cfd8db3
Pass a MutableAppContext to Element::layout and ::dispatch_event
...
We need to mutate the app in these cases to relay layout state, so this just makes things easier. We won't be able to perform layout in parallel but it's questionable whether we'll ever actually do that. If we do, we can revisit.
Co-Authored-By: Antonio Scandurra <me@as-cii.com >
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com >
2021-07-23 10:52:08 -06:00
Antonio Scandurra and Nathan Sobo
d65d035b6e
Optimize Buffer::edits_since when the version hasn't changed
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-07-23 16:31:00 +02:00
Antonio Scandurra and Nathan Sobo
bc70dcd2be
Don't insert empty isomorphic transforms when interpolating
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-07-23 16:20:27 +02:00
Antonio Scandurra and Nathan Sobo
ab2a09f071
Get wrapping randomized test passing with wrap width as small as 0
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-07-23 15:58:05 +02:00
Antonio Scandurra and Nathan Sobo
1b4357919c
Expand tabs correctly in TabMap's highlighted chunks iterator
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-07-23 15:08:59 +02:00
Antonio Scandurra
e93eed360f
Don't poll foreground futures during DeterministicExecutor::block_on
2021-07-23 12:06:58 +02:00
Antonio Scandurra
6e49f2a02e
Fix wrap map randomized tests
2021-07-23 11:26:53 +02:00
Max Brunsfeld
908cead699
Get randomized test compiling against new WrapMap structure
...
It doesn't pass.
2021-07-22 20:45:14 -07:00
Max Brunsfeld
c3c94b023f
Move LineWrapper test to line_wrapper.rs
2021-07-22 20:42:18 -07:00
Max Brunsfeld and Nathan Sobo
ebc986a0e2
Start restructuring WrapMap with simpler concurrency
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-07-22 16:21:42 -07:00
Antonio Scandurra
30b31de8f5
WIP
2021-07-22 18:31:01 +02:00
Antonio Scandurra
9d400b96c6
Fix panic in WrapMap::highlighted_chunks_for_rows
...
Also, add a unit test for `DisplayMap` with syntax highlighting when
soft wrap is on.
2021-07-22 10:08:29 +02:00
Max Brunsfeld
e7c1d015a3
Start work on wrapping lines without text shaping
2021-07-21 17:50:37 -07:00
Nathan Sobo
e6f90775e1
Ensure that soft wrapped lines don't cause horizontal scrolling
2021-07-21 12:27:01 -06:00
Nathan Sobo
3decbcd368
Remove logging
2021-07-21 11:21:13 -06:00
Antonio Scandurra and Nathan Sobo
4381aa205b
Fix WrapMap::clip_point at the end of a soft-wrapped line
...
If that's the case and `Bias` is `Left` we clip to the last
character of the soft-wrapped line.
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-07-21 18:32:32 +02:00
Antonio Scandurra and Nathan Sobo
fe015848d8
Ensure that we use the WrapMap where appropriate in DisplayMap
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-07-21 18:04:58 +02:00
Antonio Scandurra and Nathan Sobo
f7edc950d3
Account for the impact of edits on tab expansion
...
Tab characters are expanded differently based on the column on which
they appear, which edits can affect. Thus, `TabMap::sync` will now
expand edits to the first tab that appears on the line in which the edit
occurred.
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-07-21 17:18:15 +02:00
Antonio Scandurra
9fcbea3180
Add randomized test for DisplayMap::buffer_rows and fix logic errors
2021-07-21 14:45:25 +02:00