Skip to content

Allow empty splits on panes#40245

Merged
MrSubidubi merged 30 commits intozed-industries:mainfrom
iff:split-behavior
Dec 21, 2025
Merged

Allow empty splits on panes#40245
MrSubidubi merged 30 commits intozed-industries:mainfrom
iff:split-behavior

Conversation

@iff
Copy link
Contributor

@iff iff commented Oct 15, 2025

Draft as a base for continuing the discussion in #8008 : adds a SplitOperation enum to support bindings like ["pane::SplitLeft", {"operation": "Clear"}]

To be discussed @MrSubidubi and others:

  • Naming: Generally not happy with names yet and specifically Empty is unclear, e.g., what does this mean for terminal panes? Added placeholder code to split without cloning, but unsure what users would expect in this case.
  • I removed SplitAndMoveXyz actions but I guess we should keep them for backwards compatibility?
  • May have missed details in the move implementation. Will check the code again for opportunities to refactor more code after we agree on the approach.
  • Tests should go to crates/collab/src/tests/integration_tests.rs?

Closes #8008

Release Notes:

  • Add pane::Split mode ({ClonePane,EmptyPane,MovePane}) to allow creating an empty buffer.

- adding an enum for SplitBehavior (naming not final) to support bindings like `["pane::SplitLeft", {"behavior": "Empty"}]`
- subsuming SplitAndMoveDirection actions but probably have to keep them (?)
- empty behavior for terminal panes: unclear what this means. Currently split but does not clone.
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Oct 15, 2025
@iff iff marked this pull request as draft October 15, 2025 11:09
@MrSubidubi MrSubidubi self-assigned this Oct 15, 2025
@zelenenka
Copy link
Contributor

@iff thanks for the PR! are you still working on this?

@iff
Copy link
Contributor Author

iff commented Nov 13, 2025

Yup. Just waiting for feedback.

@zelenenka
Copy link
Contributor

@iff got it, thanks. i'll ping people internally!

@MrSubidubi
Copy link
Member

Sorry for the long delay from my side here:

  • Naming: Do see the issue, but lack much better ideas currently. We could perhaps instead of "behavior" name it "operation", which might make things more clear, but other than that, lack good ideas currently as well. That said, we can also be more verbose with the names if that helps, just a thought.
  • We very much should keep these around, sadly, because we need these for the command palette to show up. Fine to just keep them as aliases for the specific variants possible then (e.g., on SplitAndMoveRight, you just invoke your method with that enum variant`.
  • Regarding tests: Would be best to not have them there - best case they would go into pane.rs as well. Feel free to copy anything you need for that into these tests from elsewhere and feel free to ping me if there are any other questions.

Other than that, sorry again for the long delay in review and thank you for picking this up!

@iff
Copy link
Contributor Author

iff commented Nov 17, 2025

@MrSubidubi no worries at all and completely understandable. Thanks for the feedback - I will work on integrating the feedback and finishing the implementation this week.

@iff iff marked this pull request as ready for review November 20, 2025 11:27
@iff
Copy link
Contributor Author

iff commented Nov 20, 2025

@MrSubidubi Maybe it is a good time for a first round of feedback? I could use some guidance with respects to unittests and coverage you expect, and there are still some minor comments in the code that I can resolve after getting feedback.

@MrSubidubi
Copy link
Member

@iff Sorry for not getting to this thus far! Am only working part-time and could not find the time this week yet. Will try to get to this later this week, next Monday at latest. Sorry!

@iff
Copy link
Contributor Author

iff commented Nov 26, 2025

@MrSubidubi No worries at all! I completely understand.. I am also juggling part‑time work, so I know how quickly things can fill up. Take the time you need - there’s absolutely no rush. Looking forward to hearing from you whenever you’re able to get to it.

Copy link
Member

@MrSubidubi MrSubidubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two days delayed. sorry. Some thoughts, please ping me if you feel I am missing something.

// TODO naming
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default)]
#[serde(deny_unknown_fields)]
pub enum SplitOperation {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the TODO, but still lack better ideas

  • SplitKind is meh IMO but
  • SplitOperationKind is a bit long

Do you have a better idea?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will spend some time trying to come up with alternatives..

Copy link
Contributor Author

@iff iff Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MrSubidubi It is hard to escape previous ideas. SplitOperationKind is long, but is not excessively so (e.g., ResourceOperationKind is also used). If we want to be short, the only options I can think of are SplitEffect or SplitMode?

The Clear enum variant is still bothering me. Fundamentally, the issue stems from terminal and editor panes not sharing the same behavior for opening a "new and empty" pane (terminal pane is never empty). I do not have a good idea for a term that captures the behavior for both panes - aside from the very generic New..

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think SplitMode might also be good, still captures this quite well I think.

We could also do something like

enum SplitMode {
    CloneItem,
    MoveItem,
    EmptyPane // or NewPane
}

but then, not sure whether that is actually better. Happy to go with Clear if you think the above is worse, I'll also think a bit more about it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I missed this earlier, but I actually prefer your suggested naming. I would make all variants end with Pane (e.g., ClonePane). Or is Item a term you use in connection with panes? EmptyPane still feels a bit odd for a terminal pane, since it’s never truly empty (there’s always a prompt), but it’s probably good enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MrSubidubi pushed a commit changing the name to SplitMode (and mode in SplitXYZ)

@iff
Copy link
Contributor Author

iff commented Dec 11, 2025

@MrSubidubi Do you want me to resolve the comments I have addressed, or should I keep them open as a reminder to check those changes?

@MrSubidubi
Copy link
Member

I can resolve them one by one, good idea.

One thing before the last review and before I get this in (thank you so much already for being persistent here and doing awesome work): We desperately need the comments for the action structs - we use them throughout the app to provide some sort of context on these actions, so we should definitely not remove them (e.g. you can test this by searching for the pane actions in the keymap editor and hovering on the action name).

Sorry for mentioning this only now, could you find a somewhat functioning way to re-add these?

@iff
Copy link
Contributor Author

iff commented Dec 15, 2025

Ah, yeah - that makes sense. I’ll fix it later today and resolve the merge conflicts in terminal_panel.rs.

@iff
Copy link
Contributor Author

iff commented Dec 15, 2025

@MrSubidubi I initially missed that the Action derive macro requires a literal. I think the change above is the minimal fix to make it work (I get the docstring on hover in the keymap editor). Let me know if you’d prefer another solution (for example, adapting the Action macro)

Copy link
Member

@MrSubidubi MrSubidubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very much like the solution you came up with, thank you very much!

One last question that is not necessarily blocking and I think we are good to merge

// TODO naming
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default)]
#[serde(deny_unknown_fields)]
pub enum SplitOperation {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think SplitMode might also be good, still captures this quite well I think.

We could also do something like

enum SplitMode {
    CloneItem,
    MoveItem,
    EmptyPane // or NewPane
}

but then, not sure whether that is actually better. Happy to go with Clear if you think the above is worse, I'll also think a bit more about it

@MrSubidubi
Copy link
Member

Sigh, sorry for the merge conflict coming in. Could you resolve that? No need for it to be today, but I'll try to get back to you over the weekend/next week at latest

@iff
Copy link
Contributor Author

iff commented Dec 19, 2025

No problem. I’ll try to finish it up by the end of today.

iff added 3 commits December 19, 2025 11:53
- user intended to add an empty panel where the current item is and move the item to the other direction
- still needs testing and one check in the unit tests is missing
@iff iff requested a review from MrSubidubi December 19, 2025 21:18
Copy link
Member

@MrSubidubi MrSubidubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Thank you so much for bearing with me, absolutely awesome job on this. Good improvement, good code and a pleasure to discuss this with you.

Sorry for me being a bit unresponsive at the start and inbetween and thank you for being fine with it. Hope to see you again in another PR perhaps, other than that, happy holidays!

@MrSubidubi MrSubidubi enabled auto-merge (squash) December 21, 2025 23:41
@MrSubidubi MrSubidubi merged commit 3b626c8 into zed-industries:main Dec 21, 2025
23 checks passed
@github-project-automation github-project-automation bot moved this from Community PRs to Done in Quality Week – December 2025 Dec 21, 2025
@iff iff deleted the split-behavior branch December 22, 2025 11:46
rtfeldman pushed a commit that referenced this pull request Jan 5, 2026
Draft as a base for continuing the discussion in #8008 : adds a
`SplitOperation` enum to support bindings like `["pane::SplitLeft",
{"operation": "Clear"}]`

To be discussed @MrSubidubi and others:

- Naming: Generally not happy with names yet and specifically `Empty` is
unclear, e.g., what does this mean for terminal panes? Added placeholder
code to split without cloning, but unsure what users would expect in
this case.
- ~~I removed `SplitAndMoveXyz` actions but I guess we should keep them
for backwards compatibility?~~
- May have missed details in the move implementation. Will check the
code again for opportunities to refactor more code after we agree on the
approach.
- ~~Tests should go to `crates/collab/src/tests/integration_tests.rs`?~~

Closes #8008

Release Notes:

- Add `pane::Split` mode (`{ClonePane,EmptyPane,MovePane}`) to allow
creating an empty buffer.

---------

Co-authored-by: Finn Evers <finn.evers@outlook.de>
Co-authored-by: MrSubidubi <finn@zed.dev>
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
Draft as a base for continuing the discussion in zed-industries#8008 : adds a
`SplitOperation` enum to support bindings like `["pane::SplitLeft",
{"operation": "Clear"}]`

To be discussed @MrSubidubi and others:

- Naming: Generally not happy with names yet and specifically `Empty` is
unclear, e.g., what does this mean for terminal panes? Added placeholder
code to split without cloning, but unsure what users would expect in
this case.
- ~~I removed `SplitAndMoveXyz` actions but I guess we should keep them
for backwards compatibility?~~
- May have missed details in the move implementation. Will check the
code again for opportunities to refactor more code after we agree on the
approach.
- ~~Tests should go to `crates/collab/src/tests/integration_tests.rs`?~~

Closes zed-industries#8008

Release Notes:

- Add `pane::Split` mode (`{ClonePane,EmptyPane,MovePane}`) to allow
creating an empty buffer.

---------

Co-authored-by: Finn Evers <finn.evers@outlook.de>
Co-authored-by: MrSubidubi <finn@zed.dev>
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
Draft as a base for continuing the discussion in zed-industries#8008 : adds a
`SplitOperation` enum to support bindings like `["pane::SplitLeft",
{"operation": "Clear"}]`

To be discussed @MrSubidubi and others:

- Naming: Generally not happy with names yet and specifically `Empty` is
unclear, e.g., what does this mean for terminal panes? Added placeholder
code to split without cloning, but unsure what users would expect in
this case.
- ~~I removed `SplitAndMoveXyz` actions but I guess we should keep them
for backwards compatibility?~~
- May have missed details in the move implementation. Will check the
code again for opportunities to refactor more code after we agree on the
approach.
- ~~Tests should go to `crates/collab/src/tests/integration_tests.rs`?~~

Closes zed-industries#8008

Release Notes:

- Add `pane::Split` mode (`{ClonePane,EmptyPane,MovePane}`) to allow
creating an empty buffer.

---------

Co-authored-by: Finn Evers <finn.evers@outlook.de>
Co-authored-by: MrSubidubi <finn@zed.dev>
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Feb 15, 2026
Draft as a base for continuing the discussion in zed-industries#8008 : adds a
`SplitOperation` enum to support bindings like `["pane::SplitLeft",
{"operation": "Clear"}]`

To be discussed @MrSubidubi and others:

- Naming: Generally not happy with names yet and specifically `Empty` is
unclear, e.g., what does this mean for terminal panes? Added placeholder
code to split without cloning, but unsure what users would expect in
this case.
- ~~I removed `SplitAndMoveXyz` actions but I guess we should keep them
for backwards compatibility?~~
- May have missed details in the move implementation. Will check the
code again for opportunities to refactor more code after we agree on the
approach.
- ~~Tests should go to `crates/collab/src/tests/integration_tests.rs`?~~

Closes zed-industries#8008

Release Notes:

- Add `pane::Split` mode (`{ClonePane,EmptyPane,MovePane}`) to allow
creating an empty buffer.

---------

Co-authored-by: Finn Evers <finn.evers@outlook.de>
Co-authored-by: MrSubidubi <finn@zed.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

Development

Successfully merging this pull request may close these issues.

Optionally open empty splits instead of copying split window

3 participants