Commit graph

828 commits

Author SHA1 Message Date
Antonio Scandurra
37ca06df53 Clear multi-buffer redo stack when pushing transaction onto undo stack 2022-05-22 10:44:32 +02:00
Max Brunsfeld
c4fc3d9c7f
Merge pull request #1023 from zed-industries/app-menu-improvements
Correctly populate application menus' keystrokes and enabled status
2022-05-20 10:22:20 -07:00
Max Brunsfeld
ef0b584532 Remove AppState from workspace actions
This allows those actions to be bound to keystrokes in the keymap.
Also, remove the WorkspaceParams struct, simplify how Workspaces are
constructed.
2022-05-19 14:37:26 -07:00
Keith Simmons
bacfed37b7 Clone selections on editor split 2022-05-19 11:22:53 -07:00
Antonio Scandurra
c0bf4a5bfd Bump FoldSnapshot version if excerpt gets edited outside of its bounds
This will cause layers above `FoldMap` to grab a fresh snapshot of the `FoldMap`
and, as a result, of the underlying `MultiBufferSnapshot`. It is a necessary change
because, even though the coordinate space is not affected, a buffer edit taking place
*before* an excerpt range could cause the excerpt buffer rows to change, e.g. if
lines were added or removed. This manifested itself in a randomized test.
2022-05-18 10:13:18 +02:00
Keith Simmons
a2fd41174f Reduce accessibility of multibuffer read to reduce risk of borrowing snapshot and buffer refcells twice 2022-05-13 16:58:30 -07:00
Keith Simmons
45ea3d4c38 Review fixes 2022-05-13 15:55:27 -07:00
Keith Simmons
20c97637a4 minor tweaks to selections collection api 2022-05-13 15:55:27 -07:00
Keith Simmons
c3a36e6d8a Rename selected_ranges and selected_display_ranges to remove redundant selected 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
db0a9114c2 Passing tests and removed local argument. Also pulled autoscroll argument out to change_selections 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
Keith Simmons
c4738d7316 Add test coverage for same cursor in multiple excerpts of the same buffer 2022-05-10 14:30:27 -07:00
Keith Simmons
68de51ba8a Fix multiple cursors inserting repeated text in multibuffers 2022-05-10 13:32:27 -07:00
Keith Simmons
6c57fcf9be
Merge pull request #968 from zed-industries/vim-visual-mode
Vim visual mode
2022-05-10 12:51:58 -07:00
Keith Simmons
37c921f972 Initial visual mode 2022-05-10 11:12:28 -07:00
Antonio Scandurra
61346f734d WIP 2022-05-05 15:15:58 +02:00
Max Brunsfeld
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
Max Brunsfeld
d4492086b3 Abstract more local project setup inside Project::test helper 2022-05-04 10:28:09 -07:00
Antonio Scandurra
aa4919a76f
Merge pull request #964 from zed-industries/transpose
Introduce `Editor::transpose` bound to `ctrl-t`
2022-05-04 10:04:55 +02:00
Antonio Scandurra
9a7c07f539 Improve transpose when cursors are two chars away from each other 2022-05-04 09:59:34 +02:00
Antonio Scandurra
95680aa5f2 Account for multi-byte characters in Editor::transpose 2022-05-03 14:35:03 +02:00
Antonio Scandurra
b6ff07afac Add failing test for multi-byte characters 2022-05-03 14:33:57 +02:00
Antonio Scandurra
070607c821 Implement Editor::transpose without accounting for multi-byte chars 2022-05-03 14:33:43 +02:00
Keith Simmons
b2138f5935 Add insert line above and below 2022-05-02 11:49:10 -07:00
Keith Simmons
833a7b6e76 WIP just missing insert line above and below 2022-05-02 11:49:10 -07:00
Antonio Scandurra
2977b33dd9 Use the new batched edit API when pasting
This fixes a bug that would cause zed to paste text at the wrong
location when inside a multi-buffer where the same buffer was excerpted
more than once.
2022-05-02 10:21:53 +02:00
Antonio Scandurra
5821ce9b82 Insert newlines on paste if copied selections don't match current ones 2022-05-02 10:21:20 +02:00
Keith Simmons
d4bef67cf2
Merge pull request #929 from zed-industries/non-uniform-batched-edits
Allow batched edits where each range is associated with different insertion text
2022-04-29 16:14:38 -07:00
Keith Simmons
2eb1c107ce Convert common edit strings to Arc<str> and simplify duplicate line 2022-04-29 14:57:20 -07:00
Max Brunsfeld
2c2ca1bfbd Reduce string allocations in Editor::insert
Co-authored-by: Nathan Sobo <nathan@zed.dev>
Co-authored-by: Keith Simmons <keith@zed.dev>
2022-04-29 10:07:21 -07:00
Keith Simmons
b4b61b4bbc Consolidate edit and edit_batched functions 2022-04-28 16:52:04 -07:00
Max Brunsfeld
fa358c01cf Add format_on_save setting
This lets you turn of formatting on save for specific languages.
2022-04-28 14:31:06 -07:00
Keith Simmons
74b467aaa8 tweak editor selection mutating functions 2022-04-28 13:46:06 -07:00
Keith Simmons
42b900774e add anchor to selection fixup info in newline 2022-04-28 13:10:31 -07:00
Max Brunsfeld
37a3cead03
Merge pull request #921 from zed-industries/new-status-bar-design
Style the status bar according to the latest design
2022-04-28 12:42:25 -07:00
Antonio Scandurra
0bb889afec
Merge pull request #923 from zed-industries/navigate-panic
Clip `scroll_top_row` before navigating back to it
2022-04-28 10:22:09 +02:00
Keith Simmons
04fc1d5982 Building, but failing test WIP 2022-04-27 17:25:38 -07:00
Max Brunsfeld
a3700e0dd8 Combine diagnostic status w/ diagnostic message indicators
Improve the indicator styling
2022-04-27 14:25:39 -07:00
Max Brunsfeld
3ad13bdd4f Display buffers in order of their path in refactor multibuffers
Previously, they were non-deterministically ordered via a HashMap iterator.
This was causing integration tests to fail spuriously on PRs.
2022-04-27 14:01:37 -07:00
Antonio Scandurra
c9478cab09 Don't panic when navigation data contains invalid anchors and/or points
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-04-27 16:51:48 +02:00
Antonio Scandurra
cde5a45318 Clip scroll_top_row before navigating back to it
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-04-27 16:25:26 +02:00
Keith Simmons
c61ae6f31f
Merge pull request #877 from zed-industries/misc-normal-commands
Add inclusive vs exclusive motions to vim mode
2022-04-22 14:25:56 -07:00
Nathan Sobo
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 Scandurra
53bf7b61c0
Merge pull request #887 from zed-industries/fix-typescript-rename
Use document highlights to prepare rename if LSP doesn't support it
2022-04-22 16:37:13 +02:00
Antonio Scandurra
5e16adc6c9 Use document highlights to prepare rename if LSP doesn't support it 2022-04-22 15:43:57 +02:00
Nathan Sobo
8ec2b5e359 Delete selected text when deleting to beginning of line 2022-04-22 06:04:14 -06:00
Keith Simmons
5ea782de21 Add inclusive vs exclusive motions to vim mode 2022-04-21 16:50:23 -07:00
Antonio Scandurra
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
Antonio Scandurra
2695b13947 Always clear rename state when selections change
At some point during the implementation of rename, we added logic for
invalidating the rename state when the selection moved outside the original
rename range. After transitioning to displaying renames as a block decoration,
we don't need that anymore given that a new, temporary editor is used instead.

This commit removes that invalidation logic and always calls `Editor::take_rename`
when the editor selections change. Doing so also fixes a bug that was causing Zed
to hide the cursor when clicking on the editor to dismiss the rename.
2022-04-15 10:32:07 +02:00