Commit Graph

1094 Commits

Author SHA1 Message Date
Nathan Sobo
ca9862fff1 Start on new theme::ThemeRegistry
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2021-08-03 18:51:06 -06:00
Max Brunsfeld
81041d7841 Restructure Theme with new style objects 2021-08-03 13:36:58 -07:00
Max Brunsfeld
ef0ffbe819 Use custom color wrapper type everywhere in gpui & zed
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-03 12:48:58 -07:00
Max Brunsfeld
fa01273466 Extract {Container,Label}Style structs from those elements
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-03 11:07:03 -07:00
Nathan Sobo
200e278bc9 💄 2021-08-02 20:07:48 -06:00
Nathan Sobo
4c53470800 Notify all views when a theme is selected 2021-08-02 16:57:10 -06:00
Max Brunsfeld
b30d0daabf Add a theme picker
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-02 14:55:27 -07:00
Max Brunsfeld
e080739d57 Remove use of replace_with crate for managing element lifecycles
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-02 13:11:11 -07:00
Max Brunsfeld
76c07fb232 Make Theme::default have a non-empty replica theme vector
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-02 13:09:43 -07:00
Max Brunsfeld
92353b6967 Start work on allowing variables in themes 2021-07-30 17:28:22 -07:00
Max Brunsfeld
5ac0a1985e
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
8785f1f9c6 Use deterministic executor in randomized synchronous tests
Remove App::test function
2021-07-30 14:07:37 -07:00
Max Brunsfeld
4c3f97d123 Fix type of Workspace::open_new_file context parameter
Fixes #118
2021-07-30 10:11:46 -07:00
Max Brunsfeld
33b9a6e281 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
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
Antonio Scandurra
db9cfb0d2b Highlight active lines 2021-07-30 09:50:28 -07:00
Antonio Scandurra
3abed88c76 Highlight active row(s) in the gutter 2021-07-30 09:50:28 -07:00
Max Brunsfeld
372d2ccb6d Extract most colors in codebase into theme file. switch to dark 2021-07-30 09:50:28 -07:00
Nathan Sobo
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
Max Brunsfeld
25c472acd0 WIP - unit test for word-wise movement w/ soft wrap 2021-07-30 09:50:28 -07:00
Nathan Sobo
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
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
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
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
Nathan Sobo
a6a8f4fd81 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
029460bf7e 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
84fc8f0f4f 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
6efadd19dd Reuse FontCache across randomized tests
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-07-30 09:50:28 -07:00
Nathan Sobo
a1991a7458 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
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
c1808d09ef Add randomized test for DisplayMap
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-30 09:50:28 -07:00
Antonio Scandurra
576cabea93 WIP 2021-07-30 09:50:28 -07:00
Max Brunsfeld
8ba8fa546b Parse randomized test env vars at runtime
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-07-30 09:50:28 -07:00
Antonio Scandurra
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
b0f3778381 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
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
d6eb6d33b6 Use a uniform distribution for generating random characters 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
Nathan Sobo
47187172b7 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
b14721fd7f Clip left when moving vertically 2021-07-30 09:50:28 -07:00
Nathan Sobo
7a5f1b5446 Preserve logical scroll position when wrap width changes 2021-07-30 09:50:28 -07:00
Antonio Scandurra
3d07be34f8 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
694ab0d69d 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
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
2dcf04cfb9 Avoid allocation in LineWrapper::wrap_line
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-07-30 09:50:28 -07:00