Commit Graph
5172 Commits
Author SHA1 Message Date
acad71b1f5 WIP: Start on previous_subword_start
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Keith Simmons <keith@the-simmons.net>
2022-03-21 19:53:01 -06:00
Nathan Sobo 37420a1dd0 Extract logic for scanning over character boundaries 2022-03-21 16:01:22 -06:00
Nathan Sobo ffb280f963 Make multi-byte and surrounding_word tests more readable
Just merge multi-byte tests into the main word movement tests
2022-03-21 15:41:42 -06:00
Nathan SoboandKeith Simmons ce4280c12f Remove CharKind::Newline
This is just a character, and so it seems clearer to refer to it specifically when we want to know if a character is a newline. There was only one case where we relied on Newline being different from Whitespace, and we special-cased that instance. Changing this actually makes us match the behavior of VS Code when double-clicking runs of multiple newlines.

/cc @as-cii

Co-Authored-By: Keith Simmons <keith@the-simmons.net>
2022-03-21 15:17:32 -06:00
Nathan SoboandKeith Simmons 61b61e070f Clarify word movement function names and improve test coverage
Co-Authored-By: Keith Simmons <keith@the-simmons.net>
2022-03-21 15:17:25 -06:00
Max BrunsfeldandAntonio Scandurra 18848bd463 Match the leader's last selection when unfollowing
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-21 14:04:55 -07:00
Max BrunsfeldandAntonio Scandurra 3cfde9b2e6 Avoid infinite loop when collaborators follow each other
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-21 11:47:00 -07:00
Antonio Scandurra f04e08eb4b Hide cursor both locally and remotely when following 2022-03-21 15:16:56 +01:00
Antonio Scandurra 0ddc5453c0 Unset follower's scroll anchor when editor is scrolled all the way up 2022-03-19 10:50:23 +01:00
Max Brunsfeld 2163cacb0c Handle view updates when following
Basic following now works. Editors' scroll positions
are their only replicated view state.
2022-03-18 15:56:57 -07:00
Max Brunsfeld 395d11d98b Allow FollowableItem::to_state_message to return None
This way, we can avoid a panic if we don't handle certain cases,
like a non-singleton editor.
2022-03-18 13:36:05 -07:00
Max BrunsfeldandAntonio Scandurra 70e323e4dc Start work on updating editors's scroll positions when following
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-18 12:56:20 -07:00
Antonio Scandurra f80a5578ec WIP 2022-03-18 18:07:03 +01:00
Antonio Scandurra 2831546bce Broadcast active view to followers 2022-03-18 16:00:03 +01:00
Antonio Scandurra 55322903a9 WIP: Start on sending view updates to followers 2022-03-18 14:20:09 +01:00
Antonio Scandurra d37930e006 Serialize initial follow state in leader and reflect it in follower 2022-03-18 10:22:13 +01:00
Max Brunsfeld 6360072b43 WIP 2022-03-17 17:53:49 -07:00
Max BrunsfeldandAntonio Scandurra 41d2ba294f Always read project entry id from workspace::Item
We cannot store a workspace item's project entry id separately,
since buffers' entry ids can change (for example when doing
a *save as*).

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-17 10:58:20 -07:00
Antonio ScandurraandMax Brunsfeld ab51e04f95 Avoid passing a closure to workspace::register_project_item
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-03-17 17:39:25 +01:00
Antonio ScandurraandNathan Sobo 53d7dfb195 Introduce workspace::register_project_item
This lets downstream crates like `editor` define how project items should be
opened.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-17 15:54:34 +01:00
Antonio ScandurraandNathan Sobo c9524e63a0 Remove Editor::find_or_create
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-17 15:13:47 +01:00
Antonio ScandurraandNathan Sobo 0060010783 Add Editor::for_multibuffer and repurpose Editor::for_buffer
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-17 14:39:02 +01:00
Antonio ScandurraandNathan Sobo e158b79115 Rename app_state to global in gpui
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-17 14:33:01 +01:00
Antonio Scandurra ac220025d8 Rename open_buffer_for_path to open_buffer 2022-03-17 11:42:13 +01:00
Antonio Scandurra 88f72360b5 Search only in active pane when using Editor::find_or_create 2022-03-17 11:39:39 +01:00
Antonio Scandurra 7347e68a6d Delete unused code 2022-03-17 11:33:58 +01:00
Antonio Scandurra 60c4428900 Rename ItemView to Item 2022-03-17 11:32:46 +01:00
Antonio Scandurra e2c28d19d1 Finish refactoring of how editors are opened 2022-03-17 11:29:46 +01:00
Nathan SoboandMax Brunsfeld e5b82e80da WIP: Massage opening of editors
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-03-16 17:40:09 -06:00
29ab1f30bc Replace ProjectEntry struct with ProjectEntryId
Previously, we tracked the worktree_id and entry_id separately, but now that entry ids are unique across all worktrees this is unnecessary.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Keith Simmons <keith@the-simmons.net>
2022-03-16 15:59:47 -06:00
4c7d18530a Remove workspace::Item trait
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Keith Simmons <keith@zed.dev>
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
2022-03-16 13:34:06 -07:00
Max Brunsfeld 235f52427a Restore underline for warnings about unused code 2022-03-15 13:13:33 -07:00
Antonio ScandurraandNathan Sobo e1e907c8b0 Skip over unnecessary code diagnostics when hitting f8
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-15 15:55:39 +01:00
Antonio ScandurraandNathan Sobo 1816b44648 Fade out unnecessary code
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-15 15:51:59 +01:00
Antonio ScandurraandNathan Sobo f37b22212f Implement shift-f8 to go to previous diagnostic
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-15 15:13:23 +01:00
Antonio ScandurraandNathan Sobo 3217629af3 Don't seek FilterCursor upon creation
This lets us use `next` or `prev` to decide whether to park the cursor
at the first or last filtered item.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-15 15:13:23 +01:00
Antonio Scandurra c2c68cbfe9 Start on implementing filtering support for Cursor::prev 2022-03-15 15:13:23 +01:00
Antonio Scandurra 6013fb8d0f 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 Brunsfeld 7e24f92975 Merge pull request #621 from zed-industries/autoclose-before-punctuation
Autoclose brackets before a language-specific set of characters
2022-03-14 15:33:47 -07:00
Max Brunsfeld 77bbf76cbc Autoclose brackets before a language-specific set of characters
Fixes #588
2022-03-14 15:17:40 -07:00
Max Brunsfeld cad1725c35 Respect theme's background color when rendering field editors 2022-03-14 14:24:51 -07:00
Max BrunsfeldandAntonio Scandurra f796fa171b 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
Antonio Scandurra e1405addd2 Add more assertions to investigate #503 in the future 2022-03-14 16:53:39 +01:00
Antonio ScandurraandNathan Sobo 68191e9ba7 Ensure there's at least one selection in Editor::set_selections
This commit introduces an assertion that will cause Zed to panic as
soon as the invariant gets violated. This will be useful to investigate
issue #503.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-03-14 16:17:14 +01:00
Max Brunsfeld 836480a3e3 Merge branch 'main' into settings-file 2022-03-13 10:43:23 -07:00
Nathan SoboandAntonio Scandurra 7027cec1a9 Hide selections in original editor when renaming
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-12 10:45:11 -07:00
Nathan SoboandAntonio Scandurra a93bdc4538 🙊
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-12 10:44:11 -07:00
Nathan SoboandAntonio Scandurra 795b6344da Improve selection handling when pending rename is taken
- Set selection to the intuitive cursor position when moving up rather than restoring the full selection of the rename editor.
- When cancelling, restore the original selection.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-12 10:30:57 -07:00
Nathan Sobo ea7f2b309d Merge remote-tracking branch 'origin/main' into select-on-rename 2022-03-12 10:10:23 -07:00
Nathan SoboandAntonio Scandurra f1881795f4 Refresh document highlight after rename, but not during
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-12 10:10:06 -07:00