On 10/23/2011 03:10 PM, Bram Moolenaar wrote:

Andrei Avk wrote:

Hi, I asked about this (Disabling "drag text with html markup from
browsers") about a month ago and I finally got around to trying to find
a fix and was able to do this by recompiling Gvim with following lines
commented out:


static const GtkTargetEntry selection_targets[] =
       /* {"text/html",       0, TARGET_HTML},  */

static const GtkTargetEntry dnd_targets[] =
       /* {"text/html",       0, TARGET_HTML},  */

Hopefully if anyone else needs this they'll be able to find this
temporary fix.

Have you tried removing "html" from the 'clipboard' option?

I never had html in my 'clipboard' at all. I think 'clipboard'
does not affect drag-n-drop.


However, it seems like a completely pointless and annoying feature..
possibly it would be better to disable html drops by default and have it
available as an option?

This is a very useful feature if you are working on web pages.
I have used it to copy syntax-highlighted code, the output from 2html,
into a web page that is edited through a browser.


Fair enough, but I think a much more common case is when users drag
and drop text from browser, e.g. code samples or anything else, and
a typical webpage will have the text surrounded by a great amount
of unreadable markup that then has to be deleted.

(This is on linux, by the way).

I don't see this.  Just a simple copy and paste only contains the text,
no HTML.

Ah, wait, with gvim and using drag&  drop instead of copy&  paste I can
see it.  I'm not sure why this happens, must have something to do with
how GTK deals with the drop.  In gui_gtk_set_dnd_targets() it does check
the HTML flag in 'clipboard'...  Ah, this should fix it:


*** ../vim-7.3.346/src/gui_gtk_x11.c    2011-08-10 17:44:41.000000000 +0200
--- src/gui_gtk_x11.c   2011-10-23 20:56:38.000000000 +0200
***************
*** 3081,3087 ****

       for (i = 0; i<  (int)N_DND_TARGETS; ++i)
       {
!       if (!clip_html&&  selection_targets[i].info == TARGET_HTML)
            n_targets--;
        else
            targets[j++] = dnd_targets[i];
--- 3081,3087 ----

       for (i = 0; i<  (int)N_DND_TARGETS; ++i)
       {
!       if (!clip_html&&  dnd_targets[i].info == TARGET_HTML)
            n_targets--;
        else
            targets[j++] = dnd_targets[i];




This does work! Thanks so much for your response and the fix,
and the truly great editor (I think vim is the most impressive
program I've used).

 -ak

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to