Commit Graph

854 Commits

Author SHA1 Message Date
Antonio Scandurra
238827642a Align tooltip based on the available window space 2022-06-01 10:03:46 +02:00
Antonio Scandurra
aefdde66a6 Pass a &mut BlockContext when rendering blocks
This wraps and derefs to `RenderContext<Editor>`, so that we can
easily use `MouseEventHandler`s in blocks.
2022-05-31 15:50:34 +02:00
Antonio Scandurra
339069b1d3 Cap MessageStream buffer size to 1MB
We temporarily let it grow when the message size exceed the limit,
but restore the buffer's capacity shortly after. This ensures that,
for each connection in its entire lifetime, we only ever use 1MB.
2022-05-31 11:16:32 +02:00
Antonio Scandurra
20e1044d49 Merge branch 'main' into project-panel-with-new-mouse-events 2022-05-30 18:29:46 +02:00
Keith Simmons
4a5317b6e4 Remove unused context_menu file in rust crate 2022-05-27 11:32:15 -07:00
Antonio Scandurra
9099c40364 Merge branch 'mouse-events' into project-panel-context-menu 2022-05-27 12:07:00 +02:00
Nathan Sobo
893f15ddab Switch MouseEventHandler to use MouseRegions
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-05-26 20:00:01 -06:00
Nathan Sobo
2ea085b178 Pass a RenderContext to UniformList
In some cases, we need to render during layout. Previously, we were rendering with a LayoutContext in some cases, but this commit adds the ability to retrieve a render context with a given handle and we use that feature in UniformList.

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
2022-05-26 18:03:34 -06:00
Keith Simmons
8e7c6871db Track selection changes in mutable selections collection 2022-05-26 17:02:05 -07:00
Max Brunsfeld
42cd2ae142 Avoid switching to visual mode when following in vim mode
Co-authored-by: Keith Simmons <keith@zed.dev>
2022-05-26 17:02:05 -07:00
Keith Simmons
d11bc2a4b7 Fixup paste locations 2022-05-26 17:02:05 -07:00
Keith Simmons
e104cb94e7 fix bug in marked_range utils 2022-05-26 17:02:05 -07:00
Keith Simmons
98f9575653 WIP 2022-05-26 17:02:05 -07:00
Keith Simmons
e93c49f4f0 Unify visual line_mode and non line_mode operators 2022-05-26 17:02:05 -07:00
Keith Simmons
61f0daa5c5 Visual line mode handles soft wraps 2022-05-26 17:02:05 -07:00
Keith Simmons
082036161f Enable copy and paste in vim mode 2022-05-26 17:02:05 -07:00
Keith Simmons
d094d1d891 WIP copy on delete 2022-05-26 17:02:05 -07:00
Keith Simmons
f8f316cc64 Working change and delete in line mode 2022-05-26 17:02:05 -07:00
Keith Simmons
d7d17b2148 WIP line mode operations 2022-05-26 17:02:05 -07:00
Nathan Sobo
0866f0ed55 Introduce CursorRegion struct
This will blend in with an upcoming MouseRegion struct that sits next to it in the scene.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-05-26 11:00:10 -06:00
Nathan Sobo
6b96822c1a Fix editor tests 2022-05-26 09:59:25 +02:00
Nathan Sobo
b110fd5fb7 Render a context menu when right-clicking in project panel
It doesn't currently do anything, but I managed to get it rendering in an absolutely positioned way.
2022-05-26 09:59:25 +02:00
Max Brunsfeld
acf9a59cc2
Merge pull request #1027 from zed-industries/missing-menu-commands
Add missing File menu commands, improve handling of unsaved multibuffers
2022-05-23 21:29:32 -07:00
Max Brunsfeld
0becbe482a Distinguish between singleton and non-singleton workspace items
* Prompt to save singleton items before non-singleton ones
* Don't prompt to save multi-buffers if they contain excerpts to items that are open elsewhere and not being closed.

Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-05-23 16:03:00 -07:00
Max Brunsfeld
fbd589b589 Start work on handling multibuffers properly when closing unsaved buffers 2022-05-22 16:48:33 -07:00
Antonio Scandurra
37ca06df53 Clear multi-buffer redo stack when pushing transaction onto undo stack 2022-05-22 10:44:32 +02:00
Max Brunsfeld
e72f5cea22 Add "New Window" command 2022-05-20 11:01:20 -07: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