Skip to content

Feature request: Drag'n'drop hunks, files and changes #134

Description

@jyrimatti

Dragging and dropping things is a rather natural way to interact with a user interface.
For myself drag'n'droping hunks/files/changes would be a killer-feature, but I don't know how other people feel about it.
At least it doesn't have to be a replacement for other ways of doing things, but an addition.

What JayJay already provides:

  • drag'n'drop @-sign on the changes list (left panel) to switch the working copy
  • drag'n'drop a bookmark label on the changes list (left panel) to move it to another change

What additional things could be dragged:

  • drag'n'drop individual hunks from the diff view (right panel) into another change
  • drag'n'drop entire files from the file list (middle panel) into another change
  • drag'n'drop changes in the changes list (left panel) to reorder and/or branch them

The drag handle for these could be either the whole UI element, or a small icon in the same spirit as the @-sign and bookmark label.
I would personally prefer a small icon to reduce accidental drags.
The icon could appear only when a hunk/file/change is selected, to provide a visual cue that something became available.
It also has the benefit of providing a place for a help text, like the already implemented mouseover-functionality nicely shows.

The diff view doesn't currently provide a way to select hunks, but the "edit diff" view does. It might be a better UI to not have to open the edit view, but I'd say either way is fine.

What could still be added on top of the above:

  • select multiple hunks in the diff view (right panel) and drag them as a group into another change
  • select multiple files in the file list (middle panel) and drag them as a group into another change
  • select multiple changes in the changes list (left panel) and drag them as a group to move them to another place

For hunks, the "edit diff" view already provides a way to make multiple selections, so all that's missing is the way to drag them. Again, I'd prefer a small icon somewhere which could be used to drag all selected hunks.

For files, I think I'd prefer shift-clicking to select multiple files, since it's a widely used convention, and JayJay already implements this.
Again, a small icon could be shown when one or more files are selected, which could be used to drag all selected files.

For changes, I'd again prefer shift-clicking to select multiple changes, and a small icon to drag all selected changes.

Disclaimer

Please note that I don't have much experience with JJ and even less with Rust or SwiftUI, so I don't know which kind of features would be easy or hard to implement. I just wanted to share my thoughts on what would be a nice addition to the current functionality.
Since GG (https://github.com/gulbanana/gg) has drag'n'dropping of changes, files and hunks implemented, I assume it should be technically possible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions