Karsten Hopp 81c285
To: vim-dev@vim.org
Karsten Hopp 81c285
Subject: Patch 7.2.201
Karsten Hopp 81c285
Fcc: outbox
Karsten Hopp 81c285
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 81c285
Mime-Version: 1.0
Karsten Hopp 81c285
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 81c285
Content-Transfer-Encoding: 8bit
Karsten Hopp 81c285
------------
Karsten Hopp 81c285
Karsten Hopp 81c285
Patch 7.2.201
Karsten Hopp 81c285
Problem:    Cannot copy/paste HTML to/from Firefox via the clipboard.
Karsten Hopp 81c285
Solution:   Implement this for GTK.  Add the "html" value to 'clipboard'.
Karsten Hopp 81c285
Files:	    runtime/doc/options.txt, src/globals.h, src/gui_gtk_x11.c,
Karsten Hopp 81c285
	    src/mbyte.c, src/proto/mbyte.pro, src/option.c
Karsten Hopp 81c285
Karsten Hopp 81c285
Karsten Hopp 81c285
*** ../vim-7.2.200/runtime/doc/options.txt	2009-02-21 20:27:00.000000000 +0100
Karsten Hopp 81c285
--- runtime/doc/options.txt	2009-06-12 22:25:22.000000000 +0200
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 1443,1448 ****
Karsten Hopp 81c285
--- 1444,1457 ----
Karsten Hopp 81c285
  	autoselectml	Like "autoselect", but for the modeless selection
Karsten Hopp 81c285
  			only.  Compare to the 'A' flag in 'guioptions'.
Karsten Hopp 81c285
  
Karsten Hopp 81c285
+ 	html		When the clipboard contains HTML, use this when
Karsten Hopp 81c285
+ 			pasting.  When putting text on the clipboard, mark it
Karsten Hopp 81c285
+ 			as HTML.  This works to copy rendered HTML from
Karsten Hopp 81c285
+ 			Firefox, paste it as raw HTML in Vim, select the HTML
Karsten Hopp 81c285
+ 			in Vim and paste it in a rich edit box in Firefox.
Karsten Hopp 81c285
+ 			Only supported for GTK version 2 and later.
Karsten Hopp 81c285
+ 			Only available with the |+multi_byte| feature.
Karsten Hopp 81c285
+ 
Karsten Hopp 81c285
  	exclude:{pattern}
Karsten Hopp 81c285
  			Defines a pattern that is matched against the name of
Karsten Hopp 81c285
  			the terminal 'term'.  If there is a match, no
Karsten Hopp 81c285
*** ../vim-7.2.200/src/globals.h	2009-06-16 15:12:11.000000000 +0200
Karsten Hopp 81c285
--- src/globals.h	2009-06-12 21:10:30.000000000 +0200
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 509,514 ****
Karsten Hopp 81c285
--- 509,515 ----
Karsten Hopp 81c285
  EXTERN int	clip_unnamed INIT(= FALSE);
Karsten Hopp 81c285
  EXTERN int	clip_autoselect INIT(= FALSE);
Karsten Hopp 81c285
  EXTERN int	clip_autoselectml INIT(= FALSE);
Karsten Hopp 81c285
+ EXTERN int	clip_html INIT(= FALSE);
Karsten Hopp 81c285
  EXTERN regprog_T *clip_exclude_prog INIT(= NULL);
Karsten Hopp 81c285
  #endif
Karsten Hopp 81c285
  
Karsten Hopp 81c285
*** ../vim-7.2.200/src/gui_gtk_x11.c	2009-06-16 15:12:11.000000000 +0200
Karsten Hopp 81c285
--- src/gui_gtk_x11.c	2009-06-16 14:44:19.000000000 +0200
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 107,112 ****
Karsten Hopp 81c285
--- 107,113 ----
Karsten Hopp 81c285
      TARGET_UTF8_STRING,
Karsten Hopp 81c285
      TARGET_STRING,
Karsten Hopp 81c285
      TARGET_COMPOUND_TEXT,
Karsten Hopp 81c285
+     TARGET_HTML,
Karsten Hopp 81c285
      TARGET_TEXT,
Karsten Hopp 81c285
      TARGET_TEXT_URI_LIST,
Karsten Hopp 81c285
      TARGET_TEXT_PLAIN,
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 123,128 ****
Karsten Hopp 81c285
--- 124,130 ----
Karsten Hopp 81c285
      {VIMENC_ATOM_NAME,	0, TARGET_VIMENC},
Karsten Hopp 81c285
      {VIM_ATOM_NAME,	0, TARGET_VIM},
Karsten Hopp 81c285
  #ifdef FEAT_MBYTE
Karsten Hopp 81c285
+     {"text/html",	0, TARGET_HTML},
Karsten Hopp 81c285
      {"UTF8_STRING",	0, TARGET_UTF8_STRING},
Karsten Hopp 81c285
  #endif
Karsten Hopp 81c285
      {"COMPOUND_TEXT",	0, TARGET_COMPOUND_TEXT},
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 140,145 ****
Karsten Hopp 81c285
--- 142,148 ----
Karsten Hopp 81c285
  {
Karsten Hopp 81c285
      {"text/uri-list",	0, TARGET_TEXT_URI_LIST},
Karsten Hopp 81c285
  # ifdef FEAT_MBYTE
Karsten Hopp 81c285
+     {"text/html",	0, TARGET_HTML},
Karsten Hopp 81c285
      {"UTF8_STRING",	0, TARGET_UTF8_STRING},
Karsten Hopp 81c285
  # endif
Karsten Hopp 81c285
      {"STRING",		0, TARGET_STRING},
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 178,183 ****
Karsten Hopp 81c285
--- 181,187 ----
Karsten Hopp 81c285
   * Atoms used to control/reference X11 selections.
Karsten Hopp 81c285
   */
Karsten Hopp 81c285
  #ifdef FEAT_MBYTE
Karsten Hopp 81c285
+ static GdkAtom html_atom = GDK_NONE;
Karsten Hopp 81c285
  static GdkAtom utf8_string_atom = GDK_NONE;
Karsten Hopp 81c285
  #endif
Karsten Hopp 81c285
  #ifndef HAVE_GTK2
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 1364,1369 ****
Karsten Hopp 81c285
--- 1368,1391 ----
Karsten Hopp 81c285
  	    else
Karsten Hopp 81c285
  		text = tmpbuf_utf8;
Karsten Hopp 81c285
  	}
Karsten Hopp 81c285
+ 	else if (len >= 2 && text[0] == 0xff && text[1] == 0xfe)
Karsten Hopp 81c285
+ 	{
Karsten Hopp 81c285
+ 	    vimconv_T conv;
Karsten Hopp 81c285
+ 
Karsten Hopp 81c285
+ 	    /* UTF-16, we get this for HTML */
Karsten Hopp 81c285
+ 	    conv.vc_type = CONV_NONE;
Karsten Hopp 81c285
+ 	    convert_setup_ext(&conv, (char_u *)"utf-16le", FALSE, p_enc, TRUE);
Karsten Hopp 81c285
+ 
Karsten Hopp 81c285
+ 	    if (conv.vc_type != CONV_NONE)
Karsten Hopp 81c285
+ 	    {
Karsten Hopp 81c285
+ 		text += 2;
Karsten Hopp 81c285
+ 		len -= 2;
Karsten Hopp 81c285
+ 		tmpbuf = string_convert(&conv, text, &len;;
Karsten Hopp 81c285
+ 		convert_setup(&conv, NULL, NULL);
Karsten Hopp 81c285
+ 	    }
Karsten Hopp 81c285
+ 	    if (tmpbuf != NULL)
Karsten Hopp 81c285
+ 		text = tmpbuf;
Karsten Hopp 81c285
+ 	}
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
  #else /* !HAVE_GTK2 */
Karsten Hopp 81c285
  # ifdef FEAT_MBYTE
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 1451,1456 ****
Karsten Hopp 81c285
--- 1473,1479 ----
Karsten Hopp 81c285
  
Karsten Hopp 81c285
      if (info != (guint)TARGET_STRING
Karsten Hopp 81c285
  #ifdef FEAT_MBYTE
Karsten Hopp 81c285
+ 	    && (!clip_html || info != (guint)TARGET_HTML)
Karsten Hopp 81c285
  	    && info != (guint)TARGET_UTF8_STRING
Karsten Hopp 81c285
  	    && info != (guint)TARGET_VIMENC
Karsten Hopp 81c285
  #endif
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 1486,1491 ****
Karsten Hopp 81c285
--- 1509,1548 ----
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
  
Karsten Hopp 81c285
  #ifdef FEAT_MBYTE
Karsten Hopp 81c285
+     else if (info == (guint)TARGET_HTML)
Karsten Hopp 81c285
+     {
Karsten Hopp 81c285
+ 	vimconv_T conv;
Karsten Hopp 81c285
+ 
Karsten Hopp 81c285
+ 	/* Since we get utf-16, we probably should set it as well. */
Karsten Hopp 81c285
+ 	conv.vc_type = CONV_NONE;
Karsten Hopp 81c285
+ 	convert_setup_ext(&conv, p_enc, TRUE, (char_u *)"utf-16le", FALSE);
Karsten Hopp 81c285
+ 	if (conv.vc_type != CONV_NONE)
Karsten Hopp 81c285
+ 	{
Karsten Hopp 81c285
+ 	    tmpbuf = string_convert(&conv, string, &length);
Karsten Hopp 81c285
+ 	    convert_setup(&conv, NULL, NULL);
Karsten Hopp 81c285
+ 	    vim_free(string);
Karsten Hopp 81c285
+ 	    string = tmpbuf;
Karsten Hopp 81c285
+ 	}
Karsten Hopp 81c285
+ 
Karsten Hopp 81c285
+ 	/* Prepend the BOM: "fffe" */
Karsten Hopp 81c285
+ 	if (string != NULL)
Karsten Hopp 81c285
+ 	{
Karsten Hopp 81c285
+ 	    tmpbuf = alloc(length + 2);
Karsten Hopp 81c285
+ 	    tmpbuf[0] = 0xff;
Karsten Hopp 81c285
+ 	    tmpbuf[1] = 0xfe;
Karsten Hopp 81c285
+ 	    mch_memmove(tmpbuf + 2, string, (size_t)length);
Karsten Hopp 81c285
+ 	    vim_free(string);
Karsten Hopp 81c285
+ 	    string = tmpbuf;
Karsten Hopp 81c285
+ 	    length += 2;
Karsten Hopp 81c285
+ 
Karsten Hopp 81c285
+ 	    selection_data->type = selection_data->target;
Karsten Hopp 81c285
+ 	    selection_data->format = 16;	/* 16 bits per char */
Karsten Hopp 81c285
+ 	    gtk_selection_data_set(selection_data, html_atom, 16,
Karsten Hopp 81c285
+ 							      string, length);
Karsten Hopp 81c285
+ 	    vim_free(string);
Karsten Hopp 81c285
+ 	}
Karsten Hopp 81c285
+ 	return;
Karsten Hopp 81c285
+     }
Karsten Hopp 81c285
      else if (info == (guint)TARGET_VIMENC)
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	int l = STRLEN(p_enc);
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 3464,3469 ****
Karsten Hopp 81c285
--- 3521,3527 ----
Karsten Hopp 81c285
  
Karsten Hopp 81c285
      /* Initialise atoms */
Karsten Hopp 81c285
  #ifdef FEAT_MBYTE
Karsten Hopp 81c285
+     html_atom = gdk_atom_intern("text/html", FALSE);
Karsten Hopp 81c285
      utf8_string_atom = gdk_atom_intern("UTF8_STRING", FALSE);
Karsten Hopp 81c285
  #endif
Karsten Hopp 81c285
  #ifndef HAVE_GTK2
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 6665,6670 ****
Karsten Hopp 81c285
--- 6723,6732 ----
Karsten Hopp 81c285
  
Karsten Hopp 81c285
      for (i = 0; i < N_SELECTION_TARGETS; ++i)
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
+ #ifdef FEAT_MBYTE
Karsten Hopp 81c285
+ 	if (!clip_html && selection_targets[i].info == TARGET_HTML)
Karsten Hopp 81c285
+ 	    continue;
Karsten Hopp 81c285
+ #endif
Karsten Hopp 81c285
  	received_selection = RS_NONE;
Karsten Hopp 81c285
  	target = gdk_atom_intern(selection_targets[i].target, FALSE);
Karsten Hopp 81c285
  
Karsten Hopp 81c285
*** ../vim-7.2.200/src/mbyte.c	2009-06-16 15:12:11.000000000 +0200
Karsten Hopp 81c285
--- src/mbyte.c	2009-06-16 15:01:30.000000000 +0200
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 3265,3271 ****
Karsten Hopp 81c285
  
Karsten Hopp 81c285
  # if defined(USE_ICONV) || defined(PROTO)
Karsten Hopp 81c285
  
Karsten Hopp 81c285
! static char_u *iconv_string __ARGS((vimconv_T *vcp, char_u *str, int slen, int *unconvlenp));
Karsten Hopp 81c285
  
Karsten Hopp 81c285
  /*
Karsten Hopp 81c285
   * Call iconv_open() with a check if iconv() works properly (there are broken
Karsten Hopp 81c285
--- 3265,3271 ----
Karsten Hopp 81c285
  
Karsten Hopp 81c285
  # if defined(USE_ICONV) || defined(PROTO)
Karsten Hopp 81c285
  
Karsten Hopp 81c285
! static char_u *iconv_string __ARGS((vimconv_T *vcp, char_u *str, int slen, int *unconvlenp, int *resultlenp));
Karsten Hopp 81c285
  
Karsten Hopp 81c285
  /*
Karsten Hopp 81c285
   * Call iconv_open() with a check if iconv() works properly (there are broken
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 3326,3338 ****
Karsten Hopp 81c285
   * If "unconvlenp" is not NULL handle the string ending in an incomplete
Karsten Hopp 81c285
   * sequence and set "*unconvlenp" to the length of it.
Karsten Hopp 81c285
   * Returns the converted string in allocated memory.  NULL for an error.
Karsten Hopp 81c285
   */
Karsten Hopp 81c285
      static char_u *
Karsten Hopp 81c285
! iconv_string(vcp, str, slen, unconvlenp)
Karsten Hopp 81c285
      vimconv_T	*vcp;
Karsten Hopp 81c285
      char_u	*str;
Karsten Hopp 81c285
      int		slen;
Karsten Hopp 81c285
      int		*unconvlenp;
Karsten Hopp 81c285
  {
Karsten Hopp 81c285
      const char	*from;
Karsten Hopp 81c285
      size_t	fromlen;
Karsten Hopp 81c285
--- 3326,3340 ----
Karsten Hopp 81c285
   * If "unconvlenp" is not NULL handle the string ending in an incomplete
Karsten Hopp 81c285
   * sequence and set "*unconvlenp" to the length of it.
Karsten Hopp 81c285
   * Returns the converted string in allocated memory.  NULL for an error.
Karsten Hopp 81c285
+  * If resultlenp is not NULL, sets it to the result length in bytes.
Karsten Hopp 81c285
   */
Karsten Hopp 81c285
      static char_u *
Karsten Hopp 81c285
! iconv_string(vcp, str, slen, unconvlenp, resultlenp)
Karsten Hopp 81c285
      vimconv_T	*vcp;
Karsten Hopp 81c285
      char_u	*str;
Karsten Hopp 81c285
      int		slen;
Karsten Hopp 81c285
      int		*unconvlenp;
Karsten Hopp 81c285
+     int		*resultlenp;
Karsten Hopp 81c285
  {
Karsten Hopp 81c285
      const char	*from;
Karsten Hopp 81c285
      size_t	fromlen;
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 3418,3423 ****
Karsten Hopp 81c285
--- 3420,3428 ----
Karsten Hopp 81c285
  	/* Not enough room or skipping illegal sequence. */
Karsten Hopp 81c285
  	done = to - (char *)result;
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
+ 
Karsten Hopp 81c285
+     if (resultlenp != NULL)
Karsten Hopp 81c285
+ 	*resultlenp = (int)(to - (char *)result);
Karsten Hopp 81c285
      return result;
Karsten Hopp 81c285
  }
Karsten Hopp 81c285
  
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 5837,5844 ****
Karsten Hopp 81c285
--- 5842,5866 ----
Karsten Hopp 81c285
      char_u	*from;
Karsten Hopp 81c285
      char_u	*to;
Karsten Hopp 81c285
  {
Karsten Hopp 81c285
+     return convert_setup_ext(vcp, from, TRUE, to, TRUE);
Karsten Hopp 81c285
+ }
Karsten Hopp 81c285
+ 
Karsten Hopp 81c285
+ /*
Karsten Hopp 81c285
+  * As convert_setup(), but only when from_unicode_is_utf8 is TRUE will all
Karsten Hopp 81c285
+  * "from" unicode charsets be considered utf-8.  Same for "to".
Karsten Hopp 81c285
+  */
Karsten Hopp 81c285
+     int
Karsten Hopp 81c285
+ convert_setup_ext(vcp, from, from_unicode_is_utf8, to, to_unicode_is_utf8)
Karsten Hopp 81c285
+     vimconv_T	*vcp;
Karsten Hopp 81c285
+     char_u	*from;
Karsten Hopp 81c285
+     int		from_unicode_is_utf8;
Karsten Hopp 81c285
+     char_u	*to;
Karsten Hopp 81c285
+     int		to_unicode_is_utf8;
Karsten Hopp 81c285
+ {
Karsten Hopp 81c285
      int		from_prop;
Karsten Hopp 81c285
      int		to_prop;
Karsten Hopp 81c285
+     int		from_is_utf8;
Karsten Hopp 81c285
+     int		to_is_utf8;
Karsten Hopp 81c285
  
Karsten Hopp 81c285
      /* Reset to no conversion. */
Karsten Hopp 81c285
  # ifdef USE_ICONV
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 5856,5892 ****
Karsten Hopp 81c285
  
Karsten Hopp 81c285
      from_prop = enc_canon_props(from);
Karsten Hopp 81c285
      to_prop = enc_canon_props(to);
Karsten Hopp 81c285
!     if ((from_prop & ENC_LATIN1) && (to_prop & ENC_UNICODE))
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	/* Internal latin1 -> utf-8 conversion. */
Karsten Hopp 81c285
  	vcp->vc_type = CONV_TO_UTF8;
Karsten Hopp 81c285
  	vcp->vc_factor = 2;	/* up to twice as long */
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
!     else if ((from_prop & ENC_LATIN9) && (to_prop & ENC_UNICODE))
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	/* Internal latin9 -> utf-8 conversion. */
Karsten Hopp 81c285
  	vcp->vc_type = CONV_9_TO_UTF8;
Karsten Hopp 81c285
  	vcp->vc_factor = 3;	/* up to three as long (euro sign) */
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
!     else if ((from_prop & ENC_UNICODE) && (to_prop & ENC_LATIN1))
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	/* Internal utf-8 -> latin1 conversion. */
Karsten Hopp 81c285
  	vcp->vc_type = CONV_TO_LATIN1;
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
!     else if ((from_prop & ENC_UNICODE) && (to_prop & ENC_LATIN9))
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	/* Internal utf-8 -> latin9 conversion. */
Karsten Hopp 81c285
  	vcp->vc_type = CONV_TO_LATIN9;
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
  #ifdef WIN3264
Karsten Hopp 81c285
      /* Win32-specific codepage <-> codepage conversion without iconv. */
Karsten Hopp 81c285
!     else if (((from_prop & ENC_UNICODE) || encname2codepage(from) > 0)
Karsten Hopp 81c285
! 	    && ((to_prop & ENC_UNICODE) || encname2codepage(to) > 0))
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	vcp->vc_type = CONV_CODEPAGE;
Karsten Hopp 81c285
  	vcp->vc_factor = 2;	/* up to twice as long */
Karsten Hopp 81c285
! 	vcp->vc_cpfrom = (from_prop & ENC_UNICODE) ? 0 : encname2codepage(from);
Karsten Hopp 81c285
! 	vcp->vc_cpto = (to_prop & ENC_UNICODE) ? 0 : encname2codepage(to);
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
  #endif
Karsten Hopp 81c285
  #ifdef MACOS_X
Karsten Hopp 81c285
--- 5878,5923 ----
Karsten Hopp 81c285
  
Karsten Hopp 81c285
      from_prop = enc_canon_props(from);
Karsten Hopp 81c285
      to_prop = enc_canon_props(to);
Karsten Hopp 81c285
!     if (from_unicode_is_utf8)
Karsten Hopp 81c285
! 	from_is_utf8 = from_prop & ENC_UNICODE;
Karsten Hopp 81c285
!     else
Karsten Hopp 81c285
! 	from_is_utf8 = from_prop == ENC_UNICODE;
Karsten Hopp 81c285
!     if (to_unicode_is_utf8)
Karsten Hopp 81c285
! 	to_is_utf8 = to_prop & ENC_UNICODE;
Karsten Hopp 81c285
!     else
Karsten Hopp 81c285
! 	to_is_utf8 = to_prop == ENC_UNICODE;
Karsten Hopp 81c285
! 
Karsten Hopp 81c285
!     if ((from_prop & ENC_LATIN1) && to_is_utf8)
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	/* Internal latin1 -> utf-8 conversion. */
Karsten Hopp 81c285
  	vcp->vc_type = CONV_TO_UTF8;
Karsten Hopp 81c285
  	vcp->vc_factor = 2;	/* up to twice as long */
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
!     else if ((from_prop & ENC_LATIN9) && to_is_utf8)
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	/* Internal latin9 -> utf-8 conversion. */
Karsten Hopp 81c285
  	vcp->vc_type = CONV_9_TO_UTF8;
Karsten Hopp 81c285
  	vcp->vc_factor = 3;	/* up to three as long (euro sign) */
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
!     else if (from_is_utf8 && (to_prop & ENC_LATIN1))
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	/* Internal utf-8 -> latin1 conversion. */
Karsten Hopp 81c285
  	vcp->vc_type = CONV_TO_LATIN1;
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
!     else if (from_is_utf8 && (to_prop & ENC_LATIN9))
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	/* Internal utf-8 -> latin9 conversion. */
Karsten Hopp 81c285
  	vcp->vc_type = CONV_TO_LATIN9;
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
  #ifdef WIN3264
Karsten Hopp 81c285
      /* Win32-specific codepage <-> codepage conversion without iconv. */
Karsten Hopp 81c285
!     else if ((from_is_utf8 || encname2codepage(from) > 0)
Karsten Hopp 81c285
! 	    && (to_is_utf8 || encname2codepage(to) > 0))
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	vcp->vc_type = CONV_CODEPAGE;
Karsten Hopp 81c285
  	vcp->vc_factor = 2;	/* up to twice as long */
Karsten Hopp 81c285
! 	vcp->vc_cpfrom = from_is_utf8 ? 0 : encname2codepage(from);
Karsten Hopp 81c285
! 	vcp->vc_cpto = to_is_utf8 ? 0 : encname2codepage(to);
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
  #endif
Karsten Hopp 81c285
  #ifdef MACOS_X
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 5894,5900 ****
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	vcp->vc_type = CONV_MAC_LATIN1;
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
!     else if ((from_prop & ENC_MACROMAN) && (to_prop & ENC_UNICODE))
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	vcp->vc_type = CONV_MAC_UTF8;
Karsten Hopp 81c285
  	vcp->vc_factor = 2;	/* up to twice as long */
Karsten Hopp 81c285
--- 5925,5931 ----
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	vcp->vc_type = CONV_MAC_LATIN1;
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
!     else if ((from_prop & ENC_MACROMAN) && to_is_utf8)
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	vcp->vc_type = CONV_MAC_UTF8;
Karsten Hopp 81c285
  	vcp->vc_factor = 2;	/* up to twice as long */
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 5903,5909 ****
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	vcp->vc_type = CONV_LATIN1_MAC;
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
!     else if ((from_prop & ENC_UNICODE) && (to_prop & ENC_MACROMAN))
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	vcp->vc_type = CONV_UTF8_MAC;
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
--- 5934,5940 ----
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	vcp->vc_type = CONV_LATIN1_MAC;
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
!     else if (from_is_utf8 && (to_prop & ENC_MACROMAN))
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	vcp->vc_type = CONV_UTF8_MAC;
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 5913,5920 ****
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	/* Use iconv() for conversion. */
Karsten Hopp 81c285
  	vcp->vc_fd = (iconv_t)my_iconv_open(
Karsten Hopp 81c285
! 		(to_prop & ENC_UNICODE) ? (char_u *)"utf-8" : to,
Karsten Hopp 81c285
! 		(from_prop & ENC_UNICODE) ? (char_u *)"utf-8" : from);
Karsten Hopp 81c285
  	if (vcp->vc_fd != (iconv_t)-1)
Karsten Hopp 81c285
  	{
Karsten Hopp 81c285
  	    vcp->vc_type = CONV_ICONV;
Karsten Hopp 81c285
--- 5944,5951 ----
Karsten Hopp 81c285
      {
Karsten Hopp 81c285
  	/* Use iconv() for conversion. */
Karsten Hopp 81c285
  	vcp->vc_fd = (iconv_t)my_iconv_open(
Karsten Hopp 81c285
! 		to_is_utf8 ? (char_u *)"utf-8" : to,
Karsten Hopp 81c285
! 		from_is_utf8 ? (char_u *)"utf-8" : from);
Karsten Hopp 81c285
  	if (vcp->vc_fd != (iconv_t)-1)
Karsten Hopp 81c285
  	{
Karsten Hopp 81c285
  	    vcp->vc_type = CONV_ICONV;
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 6170,6178 ****
Karsten Hopp 81c285
  
Karsten Hopp 81c285
  # ifdef USE_ICONV
Karsten Hopp 81c285
  	case CONV_ICONV:	/* conversion with output_conv.vc_fd */
Karsten Hopp 81c285
! 	    retval = iconv_string(vcp, ptr, len, unconvlenp);
Karsten Hopp 81c285
! 	    if (retval != NULL && lenp != NULL)
Karsten Hopp 81c285
! 		*lenp = (int)STRLEN(retval);
Karsten Hopp 81c285
  	    break;
Karsten Hopp 81c285
  # endif
Karsten Hopp 81c285
  # ifdef WIN3264
Karsten Hopp 81c285
--- 6201,6207 ----
Karsten Hopp 81c285
  
Karsten Hopp 81c285
  # ifdef USE_ICONV
Karsten Hopp 81c285
  	case CONV_ICONV:	/* conversion with output_conv.vc_fd */
Karsten Hopp 81c285
! 	    retval = iconv_string(vcp, ptr, len, unconvlenp, lenp);
Karsten Hopp 81c285
  	    break;
Karsten Hopp 81c285
  # endif
Karsten Hopp 81c285
  # ifdef WIN3264
Karsten Hopp 81c285
*** ../vim-7.2.200/src/option.c	2009-05-17 13:30:58.000000000 +0200
Karsten Hopp 81c285
--- src/option.c	2009-06-12 21:09:51.000000000 +0200
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 7024,7029 ****
Karsten Hopp 81c285
--- 7024,7030 ----
Karsten Hopp 81c285
      int		new_unnamed = FALSE;
Karsten Hopp 81c285
      int		new_autoselect = FALSE;
Karsten Hopp 81c285
      int		new_autoselectml = FALSE;
Karsten Hopp 81c285
+     int		new_html = FALSE;
Karsten Hopp 81c285
      regprog_T	*new_exclude_prog = NULL;
Karsten Hopp 81c285
      char_u	*errmsg = NULL;
Karsten Hopp 81c285
      char_u	*p;
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 7047,7052 ****
Karsten Hopp 81c285
--- 7048,7058 ----
Karsten Hopp 81c285
  	    new_autoselectml = TRUE;
Karsten Hopp 81c285
  	    p += 12;
Karsten Hopp 81c285
  	}
Karsten Hopp 81c285
+ 	else if (STRNCMP(p, "html", 4) == 0 && (p[4] == ',' || p[4] == NUL))
Karsten Hopp 81c285
+ 	{
Karsten Hopp 81c285
+ 	    new_html = TRUE;
Karsten Hopp 81c285
+ 	    p += 4;
Karsten Hopp 81c285
+ 	}
Karsten Hopp 81c285
  	else if (STRNCMP(p, "exclude:", 8) == 0 && new_exclude_prog == NULL)
Karsten Hopp 81c285
  	{
Karsten Hopp 81c285
  	    p += 8;
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 7068,7073 ****
Karsten Hopp 81c285
--- 7074,7080 ----
Karsten Hopp 81c285
  	clip_unnamed = new_unnamed;
Karsten Hopp 81c285
  	clip_autoselect = new_autoselect;
Karsten Hopp 81c285
  	clip_autoselectml = new_autoselectml;
Karsten Hopp 81c285
+ 	clip_html = new_html;
Karsten Hopp 81c285
  	vim_free(clip_exclude_prog);
Karsten Hopp 81c285
  	clip_exclude_prog = new_exclude_prog;
Karsten Hopp 81c285
      }
Karsten Hopp 81c285
*** ../vim-7.2.200/src/version.c	2009-06-16 15:12:11.000000000 +0200
Karsten Hopp 81c285
--- src/version.c	2009-06-16 15:14:02.000000000 +0200
Karsten Hopp 81c285
***************
Karsten Hopp 81c285
*** 678,679 ****
Karsten Hopp 81c285
--- 678,681 ----
Karsten Hopp 81c285
  {   /* Add new patch number below this line */
Karsten Hopp 81c285
+ /**/
Karsten Hopp 81c285
+     201,
Karsten Hopp 81c285
  /**/
Karsten Hopp 81c285
Karsten Hopp 81c285
-- 
Karsten Hopp 81c285
How To Keep A Healthy Level Of Insanity:
Karsten Hopp 81c285
13. Go to a poetry recital and ask why the poems don't rhyme.
Karsten Hopp 81c285
Karsten Hopp 81c285
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 81c285
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 81c285
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 81c285
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///