Nathan Sobo
0fb59ee491
Hold a weak handle when watching settings in WrapMap
2021-09-07 22:08:40 -06:00
Nathan Sobo
17d46cef7f
Recompute wraps when font size changes
2021-09-07 21:38:14 -06:00
Max Brunsfeld and Nathan Sobo
11b8577d1b
Update FoldMap snapshot versions when only the parse tree changes
...
even if the buffer's text has not changed
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-09-06 11:57:55 -07:00
3bb5610ad1
Overhaul handling of font families
...
* Specify font families in the theme.
* Load fonts eagerly when loading themes, instead of loading
them lazily when rendering.
Co-Authored-By: Antonio Scandurra <me@as-cii.com >
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-08-26 15:06:00 -07:00
Antonio Scandurra and Nathan Sobo
1aa1e6c6ab
Move pooling of line wrappers into FontCache
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-08-25 17:28:25 +02:00
Antonio Scandurra
463284f0af
Move LineWrapper into gpui
2021-08-25 10:43:54 +02:00
Max Brunsfeld and Nathan Sobo
91c2b5825e
Add LineWrapper::wrap_shaped_line
...
This allows us to perform wrapping based on
glyph positions in an already-shaped line. We
plan to use this in the new Text element,
because there we'll already need to do text
shaping as part of layout. This text isn't editable
so it won't need to be rewrapped with the same
frequency as the text editor's content.
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-08-24 18:09:36 -07:00
Nathan Sobo and Max Brunsfeld
0187ac8fde
Share a single pool of LineWrappers across all threads
...
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com >
2021-08-24 18:16:13 -06:00
Nathan Sobo
c3dda14490
WIP: Move sum_tree module into gpui so we can use it in List
2021-08-20 16:18:39 -06:00
Max Brunsfeld and Nathan Sobo
802f1f4e78
Get new theme structure working
...
* Fix precedence of extends directives
* Always group color with font properties for text theming
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-08-04 14:07:19 -07:00
Antonio Scandurra
849604c7e4
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
Nathan Sobo and Max Brunsfeld
c306ac007c
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
e7d03af942
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
Nathan Sobo and Max Brunsfeld
aab51e7576
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
492a09f1be
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
c779633154
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
38d4662a4e
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
Max Brunsfeld and Nathan Sobo
82ed33a924
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
05f8a61bc8
Add a bias parameter when converting buffer points to fold points
2021-07-30 09:50:28 -07:00
Max Brunsfeld and Nathan Sobo
c1808d09ef
Add randomized test for DisplayMap
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-07-30 09:50:28 -07:00
c1a9a20ac9
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
42e2b9ff4d
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
169a298af1
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
e7d1af2735
Add fold mutations to randomized test for WrapMap
2021-07-30 09:50:28 -07:00
Nathan Sobo
613192974f
Don't render line numbers for soft-wrapped line segments
2021-07-30 09:50:28 -07:00
Antonio Scandurra and Nathan Sobo
164cafa57d
Preserve indentation when soft-wrapping
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-07-30 09:50:28 -07:00
Antonio Scandurra
2f1a5c48d3
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
2dcf04cfb9
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
59bb6624e2
🐎 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
9d14ca8d33
Store pending edits until applying them to a non-interpolated snapshot
2021-07-26 17:17:07 +02:00
Antonio Scandurra
1ef7474564
Change wrap width in randomized test and fix discovered bugs
2021-07-26 15:38:24 +02:00
Antonio Scandurra
0586a897ca
Fix unused variable warning
2021-07-26 13:03:43 +02:00
Antonio Scandurra
b647e3ee71
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
b04c5741aa
Set snapshot in the foreground after recomputing it in the background
2021-07-26 12:11:48 +02:00
Antonio Scandurra
0004dc6921
Remove remaining I/O nomenclature for DisplayMap coordinates
2021-07-26 11:19:36 +02:00
Nathan Sobo
61b5d66ba8
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
da50576129
Fix remaining errors and warnings
2021-07-25 07:56:53 -06:00
Nathan Sobo
9edc8b9a06
WIP
2021-07-24 08:40:48 -06:00
Nathan Sobo
3bf47be51e
WIP
2021-07-24 08:09:04 -06:00
Nathan Sobo
f81f043058
WIP
2021-07-23 12:25:09 -06:00
Antonio Scandurra and Nathan Sobo
14fcc26e73
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
a8db06426c
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
174a546c18
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
416571e8e0
Fix wrap map randomized tests
2021-07-23 11:26:53 +02:00
Max Brunsfeld
d61f26d03e
Get randomized test compiling against new WrapMap structure
...
It doesn't pass.
2021-07-22 20:45:14 -07:00
Max Brunsfeld
53fd3a1a92
Move LineWrapper test to line_wrapper.rs
2021-07-22 20:42:18 -07:00
Max Brunsfeld and Nathan Sobo
5d22c6c4bd
Start restructuring WrapMap with simpler concurrency
...
Co-Authored-By: Nathan Sobo <nathan@zed.dev >
2021-07-22 16:21:42 -07:00
Antonio Scandurra
80f13dd737
WIP
2021-07-22 18:31:01 +02:00
Antonio Scandurra
f7c8864995
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
830f5336b9
Start work on wrapping lines without text shaping
2021-07-21 17:50:37 -07:00