From: Mihai M. <mih...@xm...> - 2011-04-25 08:49:35
|
Hey guys! I use LXTerminal every day and not having drag-n-drop is very annoying - you know, moving/copying files, building, extensions, blah-blah. Using the Gnome and XFCE ones is out of question because of the dependencies & weight, otherwise they're _fine_. I finally patched LXTerminal today to add the DND support I need. Here I describe it (some copy/paste, my first intention was to submit it to the tracker, but I decided to discuss its functionality with you first): - diff against the last GIT (2011.04.25); GNU diff -Naur above the build directory - it first tries to feed the VTE with the URLs extracted by the standard GTK function (gtk_selection_data_get_uris), in the following manner: -- the addresses are inserted on a single line, each being followed by a space character ( including the last path, like gnome-terminal, unlike xfce4-terminal); I believe this is the way to go, as it's more reasonable to be required to move the cursor once, for some special cases, like adding a suffix - it's anyway necessary after a quote - instead of pressing space many times when adding files multiple times; -- the "file://" prefix is removed, if found; -- _only_ the URLs which contain troublesome characters, are put between single quotes (talking of spaces, like xfce4-terminal, unlike gnome-terminal); again, this is for good reasons, IMO; -- the URLs which contain single quotes are escaped like ' -> '\'' as expected. So (ignore the double quotes): - one path will look like: "$ /home/jacktr/girls " - one path containing spaces: "$ '/home/jacktr/Mary Kelly' " - more paths: "$ /home/jacktr/girls '/home/jacktr/Mary J. Kelly' /home/jacktr/news " - paths containing single quotes, too: "$ /home/jacktr/girls '/home/jacktr/Kelly'\''s diary' /home/jacktr/news " "$ '/home/jacktr/Mary J. Kelly' /home/jacktr/news '/home/jacktr/Nichols'\''' " (that was Nichols' :) ) - if that fails, the VTE is fed with the full DND text instead, similarily bound by quotes if it contains, spaces, \n characters and ' - escaped as well. Unlike URLs, no space is added at the end. Note that paths containing newline characters (\n) are quoted in the URL section, too, the URL parsing uses the same feed function, though in theory that will never be the case. --- I have no idea whether drag-and-drop is wanted in LXTerminal, if you're willing to implement it, I will submit the patch to the tracker. Regards, Mihai -- Mihai Militaru <mih...@xm...> |