Commit Graph
493 Commits
Author SHA1 Message Date
Antonio Scandurra 77d1574679 Pass how many lines the editor should expand to in auto height mode 2021-09-06 12:50:04 +02:00
Antonio Scandurra 1b8ea08377 Exclude selections from editor splits in Editor::active_selection_sets 2021-09-03 14:54:24 +02:00
Max Brunsfeld 522bef2e3a Add placeholder text as a feature of Editor, use it in chat panel 2021-09-02 17:36:56 -07:00
Max BrunsfeldandAntonio Scandurra 1c43121ae0 In theme, add an InputEditorSyle for styling small editors
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2021-09-02 11:20:30 -07:00
Antonio ScandurraandNathan Sobo 6a071e865f Make Line::paint interface consistent with Line::paint_wrapped
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-09-02 14:33:52 +02:00
Antonio Scandurra 0490c609fb Introduce a visible_bounds parameter to Element::paint
We're not using this yet but this will be useful to avoid rendering
unnecessary portions of text.
2021-09-02 11:42:23 +02:00
Max Brunsfeld 007d6f5eca Add a with_style method to Editor 2021-09-01 17:15:21 -07:00
Max Brunsfeld 1489c865e7 Remove ui font fields from settings 2021-08-26 17:12:56 -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 ScandurraandNathan 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 BrunsfeldandNathan 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 SoboandMax 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
Antonio Scandurra 54b4a4bf6a Allow editor to be created in auto-height mode 2021-08-24 14:17:15 +02:00
Max BrunsfeldandNathan Sobo 6df80d94ad Allow subscription/notification to be cancelled by dropping the returned Subscription
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-23 15:54:24 -07:00
Max Brunsfeld 5ecedd894d Add ChannelList to AppState 2021-08-23 15:03:45 -07:00
Max BrunsfeldandNathan Sobo 43bb38206f Add generic subscribe and observe methods to contexts
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2021-08-23 15:03:12 -07:00
Nathan Sobo 638b533fc7 WIP 2021-08-22 13:29:54 -06:00
Nathan Sobo 24639ec900 WIP 2021-08-22 11:58:19 -06:00
Nathan Sobo d68e0b0b97 Remove after_layout from Element trait
Now that layout takes a MutableAppContext we don't need an after_layout phase.
2021-08-20 16:40:45 -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
Nathan Sobo d9ab406961 Merge pull request #123 from zed-industries/fix-word-boundary-movement-multibyte
Fix moving to next word boundary with multi-byte characters
2021-08-05 08:59:20 -06:00
Max BrunsfeldandNathan 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
Max BrunsfeldandNathan Sobo 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
Antonio Scandurra d5ec0c8feb Fix moving to next word boundary with multi-byte characters
Previously, for a given point, we would create a char iterator at
the start of the row and the skip `column` characters. This is
however incorrect because display points are expressed in bytes,
and so we could park the anchor midway through a multi-byte character.

This commit fixes the issue by switching `DisplayMap::chars_at` to
take a point instead and skipping characters correctly when a point with
a non-zero column is provided.
2021-08-02 14:11:31 +02:00
Max Brunsfeld 92353b6967 Start work on allowing variables in themes 2021-07-30 17:28:22 -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 SoboandMax 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 SoboandMax 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 SoboandAntonio 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 SoboandAntonio 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 SoboandAntonio 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
Nathan SoboandAntonio Scandurra 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 SoboandAntonio Scandurra 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 SoboandAntonio Scandurra 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 BrunsfeldandNathan 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 BrunsfeldandNathan Sobo 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
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
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