Commit Graph
194 Commits
Author SHA1 Message Date
Keith Simmons 1f3dc2f534 highlight both brackets, only when empty selection, and add test 2022-07-05 15:19:05 -07:00
Keith Simmons 755636d10e Use NonZeroU32 to ensure settings tabsize cannot be zero 2022-06-23 12:55:38 -07:00
Antonio Scandurra c31a233aad Introduce a new fingerprint field to TextSummary
This is calculated in `Rope` and uses the `bromberg_sl2` homomorphic
hash function to determine the fingerprint of a single chunk and
compose each chunk fingerprint into a single fingerprint for the entire
rope that is equivalent to hashing all the rope's bytes at once.
2022-06-17 12:12:37 +02:00
Keith Simmons b51bd87c10 Rework hover delay, respect editor font size, and enable hover in multibuffers 2022-06-09 17:03:44 -07:00
Max Brunsfeld 87ba68e3ea Merge pull request #1155 from zed-industries/golang
Add Go support
2022-06-09 14:18:37 -07:00
Max Brunsfeld f62fd3cddd Add support for hard tabs
* Add a `hard_tabs` setting that causes indentation to be performed
  using a tab instead of multiple spaces.
* Change Buffer's indentation-related APIs to return an `IndentSize`
  struct with a length and a kind, instead of just a single u32.
* Use hard tabs by default in Go.
2022-06-08 18:30:10 -07:00
Antonio Scandurra 5fdafbe8c9 Expose a unique key: usize in ExcerptBoundary 2022-06-08 15:02:52 +02:00
Antonio Scandurra 15b13fe511 Introduce an optional primary field to ExcerptRange 2022-06-08 12:23:12 +02:00
Antonio Scandurra ffb75b0f02 Extract an ExcerptRange containing a context field in multi_buffer
This lays the groundwork for adding an optional `primary` field that can
be supplied to provide the "jump to" feature.
2022-06-08 12:13:04 +02:00
Antonio Scandurra 8826ad5ddd Make Buffer::edit and MultiBuffer::edit resilient to inverted ranges
Previously, we would accept edits containing out-of-order ranges. When
generating such ranges in our randomized tests, many invariants started
breaking causing e.g. undo/redo to misbehave and operation application
to panic.

In theory, we should never pass inverted ranges, but this commit changes
the above functions to swap the start and the end when that occurs to avoid
breaking the entire system and panicking.
2022-06-06 15:22:36 +02:00
Keith Simmons d7d17b2148 WIP line mode operations 2022-05-26 17:02:05 -07: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 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
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 68de51ba8a Fix multiple cursors inserting repeated text in multibuffers 2022-05-10 13:32:27 -07:00
Keith Simmons 2eb1c107ce Convert common edit strings to Arc<str> and simplify duplicate line 2022-04-29 14:57:20 -07:00
Keith Simmons b4b61b4bbc Consolidate edit and edit_batched functions 2022-04-28 16:52:04 -07:00
Keith Simmons 04fc1d5982 Building, but failing test WIP 2022-04-27 17:25:38 -07:00
Max Brunsfeld ec837fa6d7 Update breadcrumbs when multibuffers' excerpts change 2022-04-06 17:12:36 -07:00
Keith SimmonsandMax Brunsfeld 67b15ee037 Use language specific tabsize in editor commands
Co-authored-by: Max Brunsfeld <max@zed.dev>
2022-04-06 15:10:29 -07:00
Max BrunsfeldandKeith Simmons 664f17f92b Avoid maintaining indent size as state on buffers
Indent size is still hard-coded, but it's now controlled by the
editor and not the buffer.

Co-authored-by: Keith Simmons <keith@zed.dev>
2022-04-06 10:22:29 -07:00
Antonio Scandurra c39de1f9dc Show full path for file worktrees or when there is more than 1 worktree 2022-04-02 16:10:10 +02:00
Antonio Scandurra 099250c691 Introduce MultiBuffer::symbols_containing 2022-03-29 15:08:37 +02:00
Keith SimmonsandNathan Sobo 92c7b5d6ef Remove result from anchor cmp functions
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-03-24 11:48:31 -07:00
ab631cf6c3 Change language::anchor::min() to a constant
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-03-24 10:41:33 -07:00
f6805eb802 Make rename highlights work across multibuffer excerpts
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Nathan Sobo <nathan@zed.dev>
2022-03-24 10:22:47 -07:00
Antonio Scandurra 004f98cc6d Merge pull request #661 from zed-industries/follow
Introduce basic following experience
2022-03-23 15:17:44 +01:00
Nathan SoboandKeith Simmons 210fa4c443 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
Max BrunsfeldandAntonio Scandurra d02ab9bd06 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 ScandurraandNathan Sobo 021699e51c 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 Scandurra 45ce503afd Start on implementing filtering support for Cursor::prev 2022-03-15 15:13:23 +01:00
Antonio Scandurra 21eebede37 Add more assertions to investigate #503 in the future 2022-03-14 16:53:39 +01:00
Antonio ScandurraandNathan Sobo a3ea6a34d9 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
Nathan Sobo 33bcd6d904 Merge remote-tracking branch 'origin/main' into select-on-rename 2022-03-12 10:10:23 -07:00
Antonio Scandurra dd1711d53f Account for all excerpts ever inserted when determining new excerpt ID 2022-03-12 17:50:09 +01:00
Nathan Sobo 951fd1ab36 Merge branch 'main' into select-on-rename 2022-03-11 15:30:07 -07:00
Antonio Scandurra 71aa5e5360 💄 2022-03-11 17:13:28 +01:00
Antonio Scandurra a74b602f18 Assume the anchor is valid if we can find an excerpt that contains it 2022-03-11 17:08:12 +01:00
Nathan SoboandAntonio Scandurra 5407f25c94 Don't reuse excerpt ids in MultiBuffer
This prevents anchors from swapping their ordering, which was causing issues in FoldMap.

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
2022-03-11 08:50:50 -07:00
Antonio Scandurra c67cfd7fe1 Respect excerpt's range when comparing two anchors both belonging to it 2022-03-11 12:42:22 +01:00
Nathan Sobo e6b1fea117 WIP 2022-03-10 11:32:14 -07:00
Antonio Scandurra ee6d7fc6d5 Delete till previous tabstop when backspacing within indent column 2022-03-10 10:28:24 +01:00
317a1bb07b Remove language servers from buffers
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Antonio Scandurra <antonio@zed.dev>
Co-Authored-By: Keith Simmons <keith@zed.dev>
2022-03-08 15:16:07 -08:00
Antonio Scandurra afea5a3d5e 🎨 2022-02-26 14:31:36 +01:00
Antonio ScandurraandNathan Sobo 7123407f42 Don't share query editor state after project find has been split
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-25 18:10:48 +01:00
Antonio Scandurra 2611b5449f Always sync before clearing or removing excerpts from MultiBuffer
We don't have any test that proves this is needed but seems good nonetheless.
2022-02-25 15:36:43 +01:00
Antonio Scandurra ff0fa0e0bd Gracefully handle passing an empty set of ranges to push_excerpts 2022-02-25 15:36:16 +01:00
Antonio ScandurraandNathan Sobo f649074d36 Refine project find's UX
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
2022-02-25 15:27:34 +01:00