-
-
Notifications
You must be signed in to change notification settings - Fork 455
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
Text version of drag-and-dropped file does not work as expected #373
Comments
Interesting.. let me test a few things. The relevant code is in We're using QMimeData.setUrls(list-of-QUrls), and we're definitely not adding the newlines internally. iTerm2 on mac osx handles the drop fine -- the files are separated by spaces and filenames with spaces come out as e.g. I'll pushed up a version that uses both Can you try that out and see if there's a difference between both text and urls being present, vs just text? What terminal are you using ~ could it be that its mimedata URL handling code is adding the newlines? |
Some applications may prefer Text over URL mime data, so provide both. Related-to: #373 Signed-off-by: David Aguilar <davvid@gmail.com>
I did a bunch of testing on Linux and I learned quite a few things... The key thing is the gnome-terminal, on the other hand, uses text/x-moz-url when present, so we have to make sure that it contains valid data. terminator breaks in almost all configurations, so I gave up on supporting it. x-moz-list is automatically added by Qt, but it contains garbage, so we have to create it ourselves. Comparing against nautilus, there's a bunch of other keys (UTF8_STRING, etc) that are emitted, so I am adjusting git-cola to do the same. |
Generate a valid text/x-moz-url mimedata entry, encoded in utf-16, so that gnome-terminal gets the right paths when receiving the mimedata from git-cola. This should improve drag-and-drop for most applications. Closes git-cola#373 Reported-by: Taylor Braun-Jones <taylor@braun-jones.org> Signed-off-by: David Aguilar <davvid@gmail.com>
* drag-and-drop: doc: update v2.0.8 release notes draft drag-and-drop: generate better mimedata for gnome-terminal widgets: add text/plain and text/uri-list mimedata hints Closes git-cola#373 Signed-off-by: David Aguilar <davvid@gmail.com>
Awesome! git-cola keeps getting better and better! |
While gnome-terminal expects utf-16 encoded paths, other terminals, e.g. terminator, expect utf-8. There's no way we can sensibly handle this situation without making the encoding configurable. Add a cola.dragencoding variable that can be used to control the encoding used during the drag and drop operation. The default value is utf-16, but suggest utf-8 in the documentation. Mention terminator since it is known to have a problem with the utf-16 default value and works correctly when set to utf-8. utf-8 would have been a better default if gnome-terminal were not the default terminal in most Linux distributions. Related-to: #373 Signed-off-by: David Aguilar <davvid@gmail.com>
Deficiencies compared to the way drag-and-drop works when dragging and dropping files from e.g. Nautilus file browser to a terminal window:
With Nautilus the dropped string looks like:
'/path/to/file a' '/path/to/file b'
The text was updated successfully, but these errors were encountered: