Skip to content

Allow files in diff views to be dragged outside of the app #533

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 5, 2019

Conversation

zwaldowski
Copy link
Contributor

@zwaldowski zwaldowski commented Jun 26, 2019

Modernizes the table drag/drop in diff file views so it can pass file names, URLs, and promises to drags that finish outside the app.

I often find myself in the situation, particularly when resolving conflicts, that I want to open a file in an editor that would not be opened by clicking “Open with Default Editor”. This supports that use case and many more.

Dragging a file or files from… …to… …will…
any diff file list another file list in the same view stage/unstage/split/etc.
any diff file list any other file list do nothing.
the working copy an icon in the macOS Dock try to open them in the app.
the history an icon in the macOS Dock open a copy of the blobs in the app.
any diff file list Terminal paste relative paths to the files.
and diff file list Terminal, with ⌥ held paste absolute paths to the files.

Screen Recording 2019-06-25 at 12 18 58 PM

⚠️ Note, the screen recording shows Dark Mode but this PR does not include #532, it was just recorded from a combined branch.

@zwaldowski zwaldowski force-pushed the file-drag-sources branch 3 times, most recently from e6b1791 to e3598a8 Compare July 1, 2019 03:33
@zwaldowski
Copy link
Contributor Author

Updated.

@zwaldowski zwaldowski force-pushed the file-drag-sources branch 3 times, most recently from fce144a to 67058b6 Compare July 2, 2019 00:24
@lucasderraugh
Copy link
Collaborator

This all seems like an improvement to me. The only thing I notice is that dragging to Terminal from either the working directory, the index, or history all seems to result in a relative path from the directory level, never an absolute path as your chart says. Looks great other than that.

@zwaldowski zwaldowski force-pushed the file-drag-sources branch from 67058b6 to b798774 Compare July 3, 2019 01:05
@zwaldowski
Copy link
Contributor Author

Good call-out. That might be fine (since it's not a regression), the primary intent here is definitely other apps, but I'll double-check it.

@zwaldowski zwaldowski force-pushed the file-drag-sources branch from b798774 to ee6d290 Compare July 3, 2019 04:28
@zwaldowski
Copy link
Contributor Author

OK! This was my typo in the table. Terminal does no special adjudication for the pasteboard; it always requests strings — thus choosing the relative path — unless Opt is held during the drag. This is fine for now. I think we could get away with sending just the file URL all the time, but in the spirit of not having any regressions I'm leaving the PR as it is. I've updated the table in the PR description accordingly.

@zwaldowski zwaldowski force-pushed the file-drag-sources branch from ee6d290 to a04a4e0 Compare July 4, 2019 15:59
@lucasderraugh lucasderraugh merged commit 1d14681 into git-up:master Jul 5, 2019
@zwaldowski zwaldowski deleted the file-drag-sources branch July 5, 2019 23:22
simpzan pushed a commit to simpzan/GitUp that referenced this pull request Oct 22, 2020
* Remove extra indirection in file lists

* Use native table view drag handling in diff views

* Use the common dragging implementation for copying in a diff files view

* Provide the plain-text relative path for diff view drag and drop

* Allow dragging files out of the working copy into external apps

* Allow dragging files out of diffs into external apps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants