Commit Graph
31 Commits
Author SHA1 Message Date
Piotr Osiewicz 9b464f483b chore: Fix several style lints (#17488)
It's not comprehensive enough to start linting on `style` group, but
hey, it's a start.

Release Notes:

- N/A
2024-09-06 11:58:39 +02:00
Kirill BulatovandPiotr 516f654f00 Introduce DisplayRow, MultiBufferRow newtypes and BufferRow type alias (#11656)
Part of https://github.com/zed-industries/zed/issues/8081

To avoid confusion and bugs when converting between various row `u32`'s,
use different types for each.
Further PRs should split `Point` into buffer and multi buffer variants
and make the code more readable.

Release Notes:

- N/A

---------

Co-authored-by: Piotr <piotr@zed.dev>
2024-05-11 00:06:51 +03:00
Kirill Bulatov d97fd4daf0 Use Rope instead of String for buffer diff base (#11300)
As an attempt to do things better when showing diff hunks, store diff
base as Rope, not String, to have cheaper clones when the diff base text
is reused, e.g. creating another buffer with the diff base text for hunk
diff expanding.

Release Notes:

- N/A
2024-05-03 11:18:43 +03:00
Kirill Bulatov 73ac7d7292 Allow to toggle git hunk diffs (#11080)
Part of https://github.com/zed-industries/zed/issues/4523

Added two new actions with the default keybindings

```
"cmd-'": "editor::ToggleHunkDiff",
"cmd-\"": "editor::ExpandAllHunkDiffs",
```

that allow to browse git hunk diffs in Zed:


https://github.com/zed-industries/zed/assets/2690773/9a8a7d10-ed06-4960-b4ee-fe28fc5c4768


The hunks are dynamic and alter on user folds and modifications, or
toggle hidden, if the modifications were not adjacent to the expanded
hunk.


Release Notes:

- Added `editor::ToggleHunkDiff` (`cmd-'`) and
`editor::ExpandAllHunkDiffs` (`cmd-"`) actions to browse git hunk diffs
in Zed
2024-05-01 22:47:36 +03:00
HansandThorsten Ball cafd7df6ec Fix crash when joining two consecutive lines (#10000)
Release notes:

- Fixed a crash when joining two consecutive lines
([#9692](https://github.com/zed-industries/zed/pull/9692)).


This crash is not caused by `vim` or `editor`'s code logic, `join_line`
logic is okay, I found that the crash is caused by a refresh of git
`diff` after every update, hhen git diff generates hunks, it will look
for the cursor to the beginning of a line, and judge that if the cursor
result column is greater than 0, that is, it is not the beginning of a
line, it will correct the row to the next line, I think before we forgot
here that I need to adjust the column to 0 at the same time, otherwise
it is easy to go out of bounds, I am not sure if I need to add more
tests for this method, I can add if I need to, but I feel that this case
is a bit extreme

---------

Co-authored-by: Thorsten Ball <mrnugget@gmail.com>
2024-04-05 15:45:29 +02:00
Kirill Bulatov 79146926f0 Properly display deleted diff hunks (#9182)
Follow-up of https://github.com/zed-industries/zed/pull/9068 

Release Notes:

- Fixed removal diff hunks not being displayed properly in the editor
2024-03-11 17:53:45 +02:00
Kirill Bulatov d60d8d08da Add editor::RevertSelectedHunks to revert git diff hunks in the editor (#9068)
https://github.com/zed-industries/zed/assets/2690773/653b5658-e3f3-4aee-9a9d-0f2153b4141b

Release Notes:

- Added `editor::RevertSelectedHunks` (`cmd-alt-z` by default) for
reverting git hunks from the editor
2024-03-09 01:37:24 +02:00
Marshall Bowers 2f3f7cccdd Enable clippy::needless_lifetimes (#8777)
This PR enables the
[`clippy::needless_lifetimes`](https://rust-lang.github.io/rust-clippy/master/index.html#/needless_lifetimes)
rule and fixes the outstanding violations.

Release Notes:

- N/A
2024-03-03 11:52:58 -05:00
Piotr Osiewicz 204fbd7a79 text: Wrap BufferId into a newtype 2024-01-29 20:00:47 +01:00
Piotr Osiewicz a8f1c15a1e chore: Fix clippy::needless_borrow up to an editor 2024-01-21 15:03:24 +01:00
Julia a3bc3f85a9 Clean up final remaining code paths calling old diff update method 2023-05-25 14:41:09 -04:00
Mikayla Makiandmax b9fb1b649a Make scrollbar content detection cheaper
Remove scrollbars from multibuffers

co-authored-by: max <max@zed.dev>
2023-05-22 10:55:44 -07:00
Mikayla Maki b72cdb7362 Refactored apart the forward and the backwards iterator for diff hunks 2023-05-19 18:09:47 -07:00
Mikayla Makiandmax c9a3283048 refine batched anchor conversions
co-authored-by: max <max@zed.dev>
2023-05-19 16:52:57 -07:00
Mikayla Maki 3c35f275b4 Batch anchor conversions in git hunk iterator 2023-05-19 16:23:45 -07:00
JuliaandMax Brunsfeld 48c0db49da Rewrite multi-buffer aware git hunks in range to be more correct
Less ad-hoc state tracking, rely more on values provided by the
underlying data

Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-12-15 17:09:09 -05:00
Julia c0c47139aa Get tests building again 2022-12-15 00:17:28 -05:00
Julia 4c2ee3d972 Cleanup 2022-12-13 12:35:58 -05:00
Julia d100acd3b1 Initial hacky displaying of git gutter in multi-buffers 2022-12-13 12:35:58 -05:00
Julia bc601527b8 Layout git gutters inclusively 2022-10-31 14:35:42 -04:00
JuliaandKay Simmons 412c77460e Add action to go to next/previous git diff in editor
Co-Authored-By: Kay Simmons <kay@zed.dev>
2022-10-28 15:08:13 -04:00
Julia a2e05e3a47 Merge pull request #1768 from zed-industries/git-gutter-meets-code-folding
Git gutter meets code folding (and word wrap fixes)
2022-10-17 14:51:47 -04:00
Julia 7ab8f55c11 Include deletion hunks in fold regardless of end 2022-10-13 00:42:53 -04:00
Max Brunsfeld a2c9a67558 Re-export basic text types from text and language crates
Also avoid production dependencies on fs and rope in collab
2022-10-12 15:48:19 -07:00
Mikayla Maki a9ce687031 Finished refactoring out fs and rope 2022-10-11 15:25:54 -07:00
JuliaandJoseph Lyons 9905d9833c Reset buffer git diff when setting diff base to None
Co-Authored-By: Joseph Lyons <joseph@zed.dev>
2022-10-07 15:37:37 -04:00
JuliaandMikayla Maki 0615592f81 Rename head text to indicate that it's not always going to be from head
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2022-10-03 15:11:06 -04:00
Mikayla Maki da143ae46a made git diff rendering respect line wrap 2022-10-02 18:00:13 -07:00
484bdb0fc0 Start a test for remote git data updating
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
2022-09-30 15:51:32 -04:00
19cd0dedb9 Use sumtree instead of iterator linear search for diff hunks in range
Co-Authored-By: Max Brunsfeld <max@zed.dev>
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2022-09-30 13:32:54 -04:00
JuliaandMikayla Maki 1da2b63b97 Move git related things into specialized git crate
Co-Authored-By: Mikayla Maki <mikayla@zed.dev>
2022-09-29 13:16:02 -04:00