Commit Graph
109 Commits
Author SHA1 Message Date
Keith Simmons 45ea3d4c38 Review fixes 2022-05-13 15:55:27 -07:00
Keith Simmons de9dc27980 store buffer and display_map model handles on selections collection 2022-05-13 15:55:27 -07:00
Keith Simmons c9dcfff607 Move selection helpers to SelectionCollection, add update_anchor_selections, add a number of invariant preserving mutation functions to the MutableSelectionCollection 2022-05-13 15:55:17 -07:00
Antonio Scandurra 61346f734d WIP 2022-05-05 15:15:58 +02:00
Max BrunsfeldandAntonio Scandurra 8fdc5c9be3 Improve the appearance of project panel filename editor
* Always layout single-line editors with a fixed height
* Preserve directory chevron when editing folder names
* Allow theming the filename editor

Co-authored-by: Antonio Scandurra <me@as-cii.com>
2022-05-04 10:28:44 -07:00
Nathan SoboandAntonio Scandurra 92f040df00 Apply cursor styles during paint
This makes the editor's cursor an IBeam and properly deals with nested cursor styles.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-04-22 10:54:18 -06:00
Antonio ScandurraandMax Brunsfeld 5081eafa9d Always wrap lines that are wider than 512 em advances
We went with a more conservative upper bound so that the number of
characters (hopefully) never exceeds `MAX_LINE_LEN` (1024) when laying
out text.

Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-04-21 19:29:37 +02:00
Keith Simmons 292d075f81 Store accessors for editor highlight colors not colors themselves 2022-04-13 15:30:57 -07:00
Antonio Scandurra 73f2fd6b09 Pass visible bounds to Element::dispatch_event 2022-04-07 15:10:09 +02:00
Max BrunsfeldandKeith Simmons 866ffdd4ae Move Settings to its own crate
Co-authored-by: Keith Simmons <keith@zed.dev>
2022-04-06 10:23:33 -07:00
Keith SimmonsandNathan Sobo 0aaf270650 Add clip_to_line_end to display_map/snapshot and set it to ensure vim positioning in normal mode
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-03-25 20:10:52 -07:00
Antonio Scandurra 34e5a1f6bb Always render local selections on top of remote ones 2022-03-22 10:31:28 +01:00
Max Brunsfeld 1728551282 Always mirror the leader's selections when following 2022-03-21 21:47:29 -07:00
Antonio ScandurraandNathan Sobo 44d997c00c Rename app_state to global in gpui
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-17 14:33:01 +01:00
Max Brunsfeld 76fc9c955e Restore underline for warnings about unused code 2022-03-15 13:13:33 -07:00
Antonio ScandurraandNathan Sobo 7155dabf5b Fade out unnecessary code
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-15 15:51:59 +01:00
Antonio Scandurra fbf7cdf4f2 Make all HighlightStyle properties optional
Previously, some of those properties such the font weight, style and color
would be mandatory: when the theme didn't specify them, Zed would use a default
value during deserialization. This meant that those default properties would
unconditionally override the base text style, causing a rendering bug when
combining syntax highlights with diagnostic styles.

This commit fixes that by making `HighlightStyle`s more additive: each property
can be set independently and only the properties that theme specifies get
overridden in the base text style.
2022-03-15 10:39:43 +01:00
Max BrunsfeldandAntonio Scandurra e392368d89 Fix layout panic on empty editors with blocks
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-14 12:03:26 -07:00
Max Brunsfeld b33a049958 Merge branch 'main' into settings-file 2022-03-13 10:43:23 -07:00
Nathan SoboandAntonio Scandurra 992fc07133 Hide selections in original editor when renaming
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-12 10:45:11 -07:00
Max Brunsfeld 48848de82c Store settings as a global via a gpui app_state 2022-03-11 15:58:58 -08:00
Nathan Sobo 951fd1ab36 Merge branch 'main' into select-on-rename 2022-03-11 15:30:07 -07:00
Nathan Sobo 3968b37e26 When renaming, fade out the old name and select all 2022-03-10 14:55:31 -07:00
Keith Simmons 5502c00d9a swap default cursor shape back to bar 2022-03-10 13:28:13 -08:00
Keith Simmons 5b35c68d2e Fix failing gpui test from missing cursor shape 2022-03-10 13:20:45 -08:00
Keith Simmons eddb089f27 render character under block cursor 2022-03-10 13:16:31 -08:00
Keith Simmons 0d42c85195 fix formatting 2022-03-10 01:09:25 -08:00
Keith Simmons 178442a4a8 Add support for rendering cursors as a block and underscore 2022-03-10 01:09:02 -08:00
Nathan Sobo ac1eb19f83 Start on text highlight support 2022-03-09 20:51:35 -07:00
Nathan Sobo 7ef98fb935 Make versions oldest_selection and newest_selection that don't require snapshots
I thought I needed this but actually didn't, but I still kinda think it's a good change for the public interface of Editor.
2022-02-27 13:02:09 -07:00
Max BrunsfeldandNathan Sobo 47b654063e Provide editor styling information separately from editor settings
* Since regular editors' font sizes and families are controlled by
  the settings and not the theme, don't store a dummy text style in
  the theme. Instead, only store a font color, and synthesize
  the text style for regular editors using both the theme and the
  settings.
* Style single-line and auto-height editors (now called "field
  editors") using a single function that takes the entire theme and
  selects a relevant sub-object.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-24 16:42:00 -08:00
Nathan Sobo 618f0a127a Don't insert input in editor when control keys are pressed 2022-02-21 18:21:27 -07:00
66c69e538e Don't offset text vertically with gutter margin
Fixes #467

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-02-21 11:41:46 -07:00
Max BrunsfeldandNathan Sobo f0a6e8cb9c Use a block decoration for entering rename text
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-18 13:51:43 -08:00
Antonio ScandurraandNathan Sobo 7b28418979 Allow deployment of code actions from indicator
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-11 16:47:40 +01:00
Antonio ScandurraandNathan Sobo a41725daee Render code actions indicator
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-11 16:01:15 +01:00
Max Brunsfeld 5b4c0d64bc Get tests passing and project diagnostics view working w/ new excerpt headers 2022-02-09 13:51:52 -08:00
Antonio ScandurraandNathan Sobo 8d95dbe3e6 Render path headers in editor element
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-09 16:28:18 +01:00
Antonio Scandurra 0e1318dfe4 WIP: Make editor crate compile again
Tests are still failing though.
2022-02-09 11:09:11 +01:00
Max Brunsfeld 93bcde953c Consolidate logic for completion alongside code actions in Project
This way, completions are dealt with more consistently with code actions,
and the logic is not spread across so many places. The `language::File`
trait and the multibuffer no longer need to deal with completions. Completions
are no longer generic over an anchor type.
2022-02-08 14:24:45 -08:00
Nathan Sobo ba99b01de6 Generalize showing and hiding of context menus
We still cancel pending completions when hiding the context menu so its not perfectly general, but I think this is ok.
2022-02-05 12:13:02 -07:00
Nathan Sobo 93a3f4b615 Move rendering and select prev/next into ContextMenu enum
This prepares the way to have a code actions context menu.
2022-02-05 10:19:43 -07:00
Antonio Scandurra ab26a175a4 Opt into language-aware features when getting buffer chunks
We use chunks a lot to transform points and sync the various display maps,
and always querying tree-sitter or the LSP diagnostics in those cases is
unnecessarily expensive.
2022-02-03 11:21:30 +01:00
Antonio Scandurra 426ca94b52 Allow completions to bleed off the editor's bounds 2022-02-03 10:23:34 +01:00
Max Brunsfeld 88adddb324 Remove theme parameters from buffer/display map's chunks methods
Change Chunks to contain highlight ids instead of actual highlight
styles. Retrieve the actual highlight style from the theme in the
editor element layer.

This is to set us up to perform syntax highlighting in other code
paths where the theme is not available.
2022-02-02 16:33:04 -08:00
Max BrunsfeldandNathan Sobo 16c0baced6 Dispatch editor events on the autocomplete list
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-31 13:15:30 -08:00
Max BrunsfeldandNathan Sobo 6da01eac9b Make editor element's paint and layout states non-optional
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-31 13:06:59 -08:00
Max BrunsfeldandNathan Sobo c19d639e0a Derive autocomplete menu's width from the width of its largest item
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-01-31 13:01:20 -08:00
Nathan SoboandMax Brunsfeld 1a6e972ed4 Get basic list of completions rendering without styling
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-01-31 13:17:42 -07:00
ab6eb0a655 Start on completion rendering
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-01-31 12:19:17 -07:00