Karsten Hopp e230b9
To: vim_dev@googlegroups.com
Karsten Hopp e230b9
Subject: Patch 7.4.088
Karsten Hopp e230b9
Fcc: outbox
Karsten Hopp e230b9
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp e230b9
Mime-Version: 1.0
Karsten Hopp e230b9
Content-Type: text/plain; charset=UTF-8
Karsten Hopp e230b9
Content-Transfer-Encoding: 8bit
Karsten Hopp e230b9
------------
Karsten Hopp e230b9
Karsten Hopp e230b9
Patch 7.4.088
Karsten Hopp e230b9
Problem:    When spell checking is enabled Asian characters are always marked
Karsten Hopp e230b9
            as error.
Karsten Hopp e230b9
Solution:   When 'spelllang' contains "cjk" do not mark Asian characters as
Karsten Hopp e230b9
            error. (Ken Takata)
Karsten Hopp e230b9
Files:      runtime/doc/options.txt, runtime/doc/spell.txt, src/mbyte.c,
Karsten Hopp e230b9
            src/option.c, src/spell.c, src/structs.h
Karsten Hopp e230b9
Karsten Hopp e230b9
Karsten Hopp e230b9
*** ../vim-7.4.087/runtime/doc/options.txt	2013-11-06 05:26:08.000000000 +0100
Karsten Hopp e230b9
--- runtime/doc/options.txt	2013-11-12 04:00:51.000000000 +0100
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 6555,6560 ****
Karsten Hopp e230b9
--- 6555,6563 ----
Karsten Hopp e230b9
  	region by listing them: "en_us,en_ca" supports both US and Canadian
Karsten Hopp e230b9
  	English, but not words specific for Australia, New Zealand or Great
Karsten Hopp e230b9
  	Britain.
Karsten Hopp e230b9
+ 	If the name "cjk" is included East Asian characters are excluded from
Karsten Hopp e230b9
+ 	spell checking.  This is useful when editing text that also has Asian
Karsten Hopp e230b9
+ 	words.
Karsten Hopp e230b9
  							*E757*
Karsten Hopp e230b9
  	As a special case the name of a .spl file can be given as-is.  The
Karsten Hopp e230b9
  	first "_xx" in the name is removed and used as the region name
Karsten Hopp e230b9
*** ../vim-7.4.087/runtime/doc/spell.txt	2013-08-10 13:25:01.000000000 +0200
Karsten Hopp e230b9
--- runtime/doc/spell.txt	2013-11-12 04:02:27.000000000 +0100
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 269,274 ****
Karsten Hopp e230b9
--- 269,281 ----
Karsten Hopp e230b9
  	latin1		yi		transliterated Yiddish
Karsten Hopp e230b9
  	utf-8		yi-tr		transliterated Yiddish
Karsten Hopp e230b9
  
Karsten Hopp e230b9
+ 							*spell-cjk*
Karsten Hopp e230b9
+ Chinese, Japanese and other East Asian characters are normally marked as
Karsten Hopp e230b9
+ errors, because spell checking of these characters is not supported. If
Karsten Hopp e230b9
+ 'spelllang' includes "cjk", these characters are not marked as errors.  This
Karsten Hopp e230b9
+ is useful when editing text with spell checking while some Asian words are
Karsten Hopp e230b9
+ present.
Karsten Hopp e230b9
+ 
Karsten Hopp e230b9
  
Karsten Hopp e230b9
  SPELL FILES						*spell-load*
Karsten Hopp e230b9
  
Karsten Hopp e230b9
*** ../vim-7.4.087/src/mbyte.c	2013-07-05 20:07:21.000000000 +0200
Karsten Hopp e230b9
--- src/mbyte.c	2013-11-12 03:55:50.000000000 +0100
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 947,954 ****
Karsten Hopp e230b9
  		{
Karsten Hopp e230b9
  		    case 0x2121: /* ZENKAKU space */
Karsten Hopp e230b9
  			return 0;
Karsten Hopp e230b9
! 		    case 0x2122: /* KU-TEN (Japanese comma) */
Karsten Hopp e230b9
! 		    case 0x2123: /* TOU-TEN (Japanese period) */
Karsten Hopp e230b9
  		    case 0x2124: /* ZENKAKU comma */
Karsten Hopp e230b9
  		    case 0x2125: /* ZENKAKU period */
Karsten Hopp e230b9
  			return 1;
Karsten Hopp e230b9
--- 947,954 ----
Karsten Hopp e230b9
  		{
Karsten Hopp e230b9
  		    case 0x2121: /* ZENKAKU space */
Karsten Hopp e230b9
  			return 0;
Karsten Hopp e230b9
! 		    case 0x2122: /* TOU-TEN (Japanese comma) */
Karsten Hopp e230b9
! 		    case 0x2123: /* KU-TEN (Japanese period) */
Karsten Hopp e230b9
  		    case 0x2124: /* ZENKAKU comma */
Karsten Hopp e230b9
  		    case 0x2125: /* ZENKAKU period */
Karsten Hopp e230b9
  			return 1;
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 2477,2485 ****
Karsten Hopp e230b9
      /* sorted list of non-overlapping intervals */
Karsten Hopp e230b9
      static struct clinterval
Karsten Hopp e230b9
      {
Karsten Hopp e230b9
! 	unsigned short first;
Karsten Hopp e230b9
! 	unsigned short last;
Karsten Hopp e230b9
! 	unsigned short class;
Karsten Hopp e230b9
      } classes[] =
Karsten Hopp e230b9
      {
Karsten Hopp e230b9
  	{0x037e, 0x037e, 1},		/* Greek question mark */
Karsten Hopp e230b9
--- 2477,2485 ----
Karsten Hopp e230b9
      /* sorted list of non-overlapping intervals */
Karsten Hopp e230b9
      static struct clinterval
Karsten Hopp e230b9
      {
Karsten Hopp e230b9
! 	unsigned int first;
Karsten Hopp e230b9
! 	unsigned int last;
Karsten Hopp e230b9
! 	unsigned int class;
Karsten Hopp e230b9
      } classes[] =
Karsten Hopp e230b9
      {
Karsten Hopp e230b9
  	{0x037e, 0x037e, 1},		/* Greek question mark */
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 2544,2549 ****
Karsten Hopp e230b9
--- 2544,2553 ----
Karsten Hopp e230b9
  	{0xff1a, 0xff20, 1},		/* half/fullwidth ASCII */
Karsten Hopp e230b9
  	{0xff3b, 0xff40, 1},		/* half/fullwidth ASCII */
Karsten Hopp e230b9
  	{0xff5b, 0xff65, 1},		/* half/fullwidth ASCII */
Karsten Hopp e230b9
+ 	{0x20000, 0x2a6df, 0x4e00},	/* CJK Ideographs */
Karsten Hopp e230b9
+ 	{0x2a700, 0x2b73f, 0x4e00},	/* CJK Ideographs */
Karsten Hopp e230b9
+ 	{0x2b740, 0x2b81f, 0x4e00},	/* CJK Ideographs */
Karsten Hopp e230b9
+ 	{0x2f800, 0x2fa1f, 0x4e00},	/* CJK Ideographs */
Karsten Hopp e230b9
      };
Karsten Hopp e230b9
      int bot = 0;
Karsten Hopp e230b9
      int top = sizeof(classes) / sizeof(struct clinterval) - 1;
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 2563,2571 ****
Karsten Hopp e230b9
      while (top >= bot)
Karsten Hopp e230b9
      {
Karsten Hopp e230b9
  	mid = (bot + top) / 2;
Karsten Hopp e230b9
! 	if (classes[mid].last < c)
Karsten Hopp e230b9
  	    bot = mid + 1;
Karsten Hopp e230b9
! 	else if (classes[mid].first > c)
Karsten Hopp e230b9
  	    top = mid - 1;
Karsten Hopp e230b9
  	else
Karsten Hopp e230b9
  	    return (int)classes[mid].class;
Karsten Hopp e230b9
--- 2567,2575 ----
Karsten Hopp e230b9
      while (top >= bot)
Karsten Hopp e230b9
      {
Karsten Hopp e230b9
  	mid = (bot + top) / 2;
Karsten Hopp e230b9
! 	if (classes[mid].last < (unsigned int)c)
Karsten Hopp e230b9
  	    bot = mid + 1;
Karsten Hopp e230b9
! 	else if (classes[mid].first > (unsigned int)c)
Karsten Hopp e230b9
  	    top = mid - 1;
Karsten Hopp e230b9
  	else
Karsten Hopp e230b9
  	    return (int)classes[mid].class;
Karsten Hopp e230b9
*** ../vim-7.4.087/src/option.c	2013-11-08 04:30:06.000000000 +0100
Karsten Hopp e230b9
--- src/option.c	2013-11-12 04:34:46.000000000 +0100
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 7122,7127 ****
Karsten Hopp e230b9
--- 7122,7132 ----
Karsten Hopp e230b9
  	if (varp == &(curwin->w_s->b_p_spl))
Karsten Hopp e230b9
  	{
Karsten Hopp e230b9
  	    char_u	fname[200];
Karsten Hopp e230b9
+ 	    char_u	*q = curwin->w_s->b_p_spl;
Karsten Hopp e230b9
+ 
Karsten Hopp e230b9
+ 	    /* Skip the first name if it is "cjk". */
Karsten Hopp e230b9
+ 	    if (STRNCMP(q, "cjk,", 4) == 0)
Karsten Hopp e230b9
+ 		q += 4;
Karsten Hopp e230b9
  
Karsten Hopp e230b9
  	    /*
Karsten Hopp e230b9
  	     * Source the spell/LANG.vim in 'runtimepath'.
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 7129,7139 ****
Karsten Hopp e230b9
  	     * Use the first name in 'spelllang' up to '_region' or
Karsten Hopp e230b9
  	     * '.encoding'.
Karsten Hopp e230b9
  	     */
Karsten Hopp e230b9
! 	    for (p = curwin->w_s->b_p_spl; *p != NUL; ++p)
Karsten Hopp e230b9
  		if (vim_strchr((char_u *)"_.,", *p) != NULL)
Karsten Hopp e230b9
  		    break;
Karsten Hopp e230b9
! 	    vim_snprintf((char *)fname, 200, "spell/%.*s.vim",
Karsten Hopp e230b9
! 				 (int)(p - curwin->w_s->b_p_spl), curwin->w_s->b_p_spl);
Karsten Hopp e230b9
  	    source_runtime(fname, TRUE);
Karsten Hopp e230b9
  	}
Karsten Hopp e230b9
  #endif
Karsten Hopp e230b9
--- 7134,7143 ----
Karsten Hopp e230b9
  	     * Use the first name in 'spelllang' up to '_region' or
Karsten Hopp e230b9
  	     * '.encoding'.
Karsten Hopp e230b9
  	     */
Karsten Hopp e230b9
! 	    for (p = q; *p != NUL; ++p)
Karsten Hopp e230b9
  		if (vim_strchr((char_u *)"_.,", *p) != NULL)
Karsten Hopp e230b9
  		    break;
Karsten Hopp e230b9
! 	    vim_snprintf((char *)fname, 200, "spell/%.*s.vim", (int)(p - q), q);
Karsten Hopp e230b9
  	    source_runtime(fname, TRUE);
Karsten Hopp e230b9
  	}
Karsten Hopp e230b9
  #endif
Karsten Hopp e230b9
*** ../vim-7.4.087/src/spell.c	2013-09-29 13:38:25.000000000 +0200
Karsten Hopp e230b9
--- src/spell.c	2013-11-12 04:37:33.000000000 +0100
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 754,762 ****
Karsten Hopp e230b9
  static void clear_spell_chartab __ARGS((spelltab_T *sp));
Karsten Hopp e230b9
  static int set_spell_finish __ARGS((spelltab_T	*new_st));
Karsten Hopp e230b9
  static int spell_iswordp __ARGS((char_u *p, win_T *wp));
Karsten Hopp e230b9
! static int spell_iswordp_nmw __ARGS((char_u *p));
Karsten Hopp e230b9
  #ifdef FEAT_MBYTE
Karsten Hopp e230b9
! static int spell_mb_isword_class __ARGS((int cl));
Karsten Hopp e230b9
  static int spell_iswordp_w __ARGS((int *p, win_T *wp));
Karsten Hopp e230b9
  #endif
Karsten Hopp e230b9
  static int write_spell_prefcond __ARGS((FILE *fd, garray_T *gap));
Karsten Hopp e230b9
--- 754,762 ----
Karsten Hopp e230b9
  static void clear_spell_chartab __ARGS((spelltab_T *sp));
Karsten Hopp e230b9
  static int set_spell_finish __ARGS((spelltab_T	*new_st));
Karsten Hopp e230b9
  static int spell_iswordp __ARGS((char_u *p, win_T *wp));
Karsten Hopp e230b9
! static int spell_iswordp_nmw __ARGS((char_u *p, win_T *wp));
Karsten Hopp e230b9
  #ifdef FEAT_MBYTE
Karsten Hopp e230b9
! static int spell_mb_isword_class __ARGS((int cl, win_T *wp));
Karsten Hopp e230b9
  static int spell_iswordp_w __ARGS((int *p, win_T *wp));
Karsten Hopp e230b9
  #endif
Karsten Hopp e230b9
  static int write_spell_prefcond __ARGS((FILE *fd, garray_T *gap));
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 1149,1155 ****
Karsten Hopp e230b9
  
Karsten Hopp e230b9
  	/* When we are at a non-word character there is no error, just
Karsten Hopp e230b9
  	 * skip over the character (try looking for a word after it). */
Karsten Hopp e230b9
! 	else if (!spell_iswordp_nmw(ptr))
Karsten Hopp e230b9
  	{
Karsten Hopp e230b9
  	    if (capcol != NULL && wp->w_s->b_cap_prog != NULL)
Karsten Hopp e230b9
  	    {
Karsten Hopp e230b9
--- 1149,1155 ----
Karsten Hopp e230b9
  
Karsten Hopp e230b9
  	/* When we are at a non-word character there is no error, just
Karsten Hopp e230b9
  	 * skip over the character (try looking for a word after it). */
Karsten Hopp e230b9
! 	else if (!spell_iswordp_nmw(ptr, wp))
Karsten Hopp e230b9
  	{
Karsten Hopp e230b9
  	    if (capcol != NULL && wp->w_s->b_cap_prog != NULL)
Karsten Hopp e230b9
  	    {
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 1561,1567 ****
Karsten Hopp e230b9
  			 * accept a no-caps word, even when the dictionary
Karsten Hopp e230b9
  			 * word specifies ONECAP. */
Karsten Hopp e230b9
  			mb_ptr_back(mip->mi_word, p);
Karsten Hopp e230b9
! 			if (spell_iswordp_nmw(p)
Karsten Hopp e230b9
  				? capflags == WF_ONECAP
Karsten Hopp e230b9
  				: (flags & WF_ONECAP) != 0
Karsten Hopp e230b9
  						     && capflags != WF_ONECAP)
Karsten Hopp e230b9
--- 1561,1567 ----
Karsten Hopp e230b9
  			 * accept a no-caps word, even when the dictionary
Karsten Hopp e230b9
  			 * word specifies ONECAP. */
Karsten Hopp e230b9
  			mb_ptr_back(mip->mi_word, p);
Karsten Hopp e230b9
! 			if (spell_iswordp_nmw(p, mip->mi_win)
Karsten Hopp e230b9
  				? capflags == WF_ONECAP
Karsten Hopp e230b9
  				: (flags & WF_ONECAP) != 0
Karsten Hopp e230b9
  						     && capflags != WF_ONECAP)
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 4234,4240 ****
Karsten Hopp e230b9
      if (spl_copy == NULL)
Karsten Hopp e230b9
  	goto theend;
Karsten Hopp e230b9
  
Karsten Hopp e230b9
!     /* loop over comma separated language names. */
Karsten Hopp e230b9
      for (splp = spl_copy; *splp != NUL; )
Karsten Hopp e230b9
      {
Karsten Hopp e230b9
  	/* Get one language name. */
Karsten Hopp e230b9
--- 4234,4242 ----
Karsten Hopp e230b9
      if (spl_copy == NULL)
Karsten Hopp e230b9
  	goto theend;
Karsten Hopp e230b9
  
Karsten Hopp e230b9
!     wp->w_s->b_cjk = 0;
Karsten Hopp e230b9
! 
Karsten Hopp e230b9
!     /* Loop over comma separated language names. */
Karsten Hopp e230b9
      for (splp = spl_copy; *splp != NUL; )
Karsten Hopp e230b9
      {
Karsten Hopp e230b9
  	/* Get one language name. */
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 4242,4247 ****
Karsten Hopp e230b9
--- 4244,4255 ----
Karsten Hopp e230b9
  	region = NULL;
Karsten Hopp e230b9
  	len = (int)STRLEN(lang);
Karsten Hopp e230b9
  
Karsten Hopp e230b9
+ 	if (STRCMP(lang, "cjk") == 0)
Karsten Hopp e230b9
+ 	{
Karsten Hopp e230b9
+ 	    wp->w_s->b_cjk = 1;
Karsten Hopp e230b9
+ 	    continue;
Karsten Hopp e230b9
+ 	}
Karsten Hopp e230b9
+ 
Karsten Hopp e230b9
  	/* If the name ends in ".spl" use it as the name of the spell file.
Karsten Hopp e230b9
  	 * If there is a region name let "region" point to it and remove it
Karsten Hopp e230b9
  	 * from the name. */
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 4601,4607 ****
Karsten Hopp e230b9
      int		past_second = FALSE;	/* past second word char */
Karsten Hopp e230b9
  
Karsten Hopp e230b9
      /* find first letter */
Karsten Hopp e230b9
!     for (p = word; !spell_iswordp_nmw(p); mb_ptr_adv(p))
Karsten Hopp e230b9
  	if (end == NULL ? *p == NUL : p >= end)
Karsten Hopp e230b9
  	    return 0;	    /* only non-word characters, illegal word */
Karsten Hopp e230b9
  #ifdef FEAT_MBYTE
Karsten Hopp e230b9
--- 4609,4615 ----
Karsten Hopp e230b9
      int		past_second = FALSE;	/* past second word char */
Karsten Hopp e230b9
  
Karsten Hopp e230b9
      /* find first letter */
Karsten Hopp e230b9
!     for (p = word; !spell_iswordp_nmw(p, curwin); mb_ptr_adv(p))
Karsten Hopp e230b9
  	if (end == NULL ? *p == NUL : p >= end)
Karsten Hopp e230b9
  	    return 0;	    /* only non-word characters, illegal word */
Karsten Hopp e230b9
  #ifdef FEAT_MBYTE
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 4617,4623 ****
Karsten Hopp e230b9
       * But a word with an upper char only at start is a ONECAP.
Karsten Hopp e230b9
       */
Karsten Hopp e230b9
      for ( ; end == NULL ? *p != NUL : p < end; mb_ptr_adv(p))
Karsten Hopp e230b9
! 	if (spell_iswordp_nmw(p))
Karsten Hopp e230b9
  	{
Karsten Hopp e230b9
  	    c = PTR2CHAR(p);
Karsten Hopp e230b9
  	    if (!SPELL_ISUPPER(c))
Karsten Hopp e230b9
--- 4625,4631 ----
Karsten Hopp e230b9
       * But a word with an upper char only at start is a ONECAP.
Karsten Hopp e230b9
       */
Karsten Hopp e230b9
      for ( ; end == NULL ? *p != NUL : p < end; mb_ptr_adv(p))
Karsten Hopp e230b9
! 	if (spell_iswordp_nmw(p, curwin))
Karsten Hopp e230b9
  	{
Karsten Hopp e230b9
  	    c = PTR2CHAR(p);
Karsten Hopp e230b9
  	    if (!SPELL_ISUPPER(c))
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 9907,9913 ****
Karsten Hopp e230b9
  
Karsten Hopp e230b9
  	c = mb_ptr2char(s);
Karsten Hopp e230b9
  	if (c > 255)
Karsten Hopp e230b9
! 	    return spell_mb_isword_class(mb_get_class(s));
Karsten Hopp e230b9
  	return spelltab.st_isw[c];
Karsten Hopp e230b9
      }
Karsten Hopp e230b9
  #endif
Karsten Hopp e230b9
--- 9915,9921 ----
Karsten Hopp e230b9
  
Karsten Hopp e230b9
  	c = mb_ptr2char(s);
Karsten Hopp e230b9
  	if (c > 255)
Karsten Hopp e230b9
! 	    return spell_mb_isword_class(mb_get_class(s), wp);
Karsten Hopp e230b9
  	return spelltab.st_isw[c];
Karsten Hopp e230b9
      }
Karsten Hopp e230b9
  #endif
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 9920,9927 ****
Karsten Hopp e230b9
   * Unlike spell_iswordp() this doesn't check for "midword" characters.
Karsten Hopp e230b9
   */
Karsten Hopp e230b9
      static int
Karsten Hopp e230b9
! spell_iswordp_nmw(p)
Karsten Hopp e230b9
      char_u	*p;
Karsten Hopp e230b9
  {
Karsten Hopp e230b9
  #ifdef FEAT_MBYTE
Karsten Hopp e230b9
      int		c;
Karsten Hopp e230b9
--- 9928,9936 ----
Karsten Hopp e230b9
   * Unlike spell_iswordp() this doesn't check for "midword" characters.
Karsten Hopp e230b9
   */
Karsten Hopp e230b9
      static int
Karsten Hopp e230b9
! spell_iswordp_nmw(p, wp)
Karsten Hopp e230b9
      char_u	*p;
Karsten Hopp e230b9
+     win_T	*wp;
Karsten Hopp e230b9
  {
Karsten Hopp e230b9
  #ifdef FEAT_MBYTE
Karsten Hopp e230b9
      int		c;
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 9930,9936 ****
Karsten Hopp e230b9
      {
Karsten Hopp e230b9
  	c = mb_ptr2char(p);
Karsten Hopp e230b9
  	if (c > 255)
Karsten Hopp e230b9
! 	    return spell_mb_isword_class(mb_get_class(p));
Karsten Hopp e230b9
  	return spelltab.st_isw[c];
Karsten Hopp e230b9
      }
Karsten Hopp e230b9
  #endif
Karsten Hopp e230b9
--- 9939,9945 ----
Karsten Hopp e230b9
      {
Karsten Hopp e230b9
  	c = mb_ptr2char(p);
Karsten Hopp e230b9
  	if (c > 255)
Karsten Hopp e230b9
! 	    return spell_mb_isword_class(mb_get_class(p), wp);
Karsten Hopp e230b9
  	return spelltab.st_isw[c];
Karsten Hopp e230b9
      }
Karsten Hopp e230b9
  #endif
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 9942,9952 ****
Karsten Hopp e230b9
   * Return TRUE if word class indicates a word character.
Karsten Hopp e230b9
   * Only for characters above 255.
Karsten Hopp e230b9
   * Unicode subscript and superscript are not considered word characters.
Karsten Hopp e230b9
   */
Karsten Hopp e230b9
      static int
Karsten Hopp e230b9
! spell_mb_isword_class(cl)
Karsten Hopp e230b9
!     int cl;
Karsten Hopp e230b9
  {
Karsten Hopp e230b9
      return cl >= 2 && cl != 0x2070 && cl != 0x2080;
Karsten Hopp e230b9
  }
Karsten Hopp e230b9
  
Karsten Hopp e230b9
--- 9951,9966 ----
Karsten Hopp e230b9
   * Return TRUE if word class indicates a word character.
Karsten Hopp e230b9
   * Only for characters above 255.
Karsten Hopp e230b9
   * Unicode subscript and superscript are not considered word characters.
Karsten Hopp e230b9
+  * See also dbcs_class() and utf_class() in mbyte.c.
Karsten Hopp e230b9
   */
Karsten Hopp e230b9
      static int
Karsten Hopp e230b9
! spell_mb_isword_class(cl, wp)
Karsten Hopp e230b9
!     int		cl;
Karsten Hopp e230b9
!     win_T	*wp;
Karsten Hopp e230b9
  {
Karsten Hopp e230b9
+     if (wp->w_s->b_cjk)
Karsten Hopp e230b9
+ 	/* East Asian characters are not considered word characters. */
Karsten Hopp e230b9
+ 	return cl == 2 || cl == 0x2800;
Karsten Hopp e230b9
      return cl >= 2 && cl != 0x2070 && cl != 0x2080;
Karsten Hopp e230b9
  }
Karsten Hopp e230b9
  
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 9971,9979 ****
Karsten Hopp e230b9
      if (*s > 255)
Karsten Hopp e230b9
      {
Karsten Hopp e230b9
  	if (enc_utf8)
Karsten Hopp e230b9
! 	    return spell_mb_isword_class(utf_class(*s));
Karsten Hopp e230b9
  	if (enc_dbcs)
Karsten Hopp e230b9
! 	    return dbcs_class((unsigned)*s >> 8, *s & 0xff) >= 2;
Karsten Hopp e230b9
  	return 0;
Karsten Hopp e230b9
      }
Karsten Hopp e230b9
      return spelltab.st_isw[*s];
Karsten Hopp e230b9
--- 9985,9994 ----
Karsten Hopp e230b9
      if (*s > 255)
Karsten Hopp e230b9
      {
Karsten Hopp e230b9
  	if (enc_utf8)
Karsten Hopp e230b9
! 	    return spell_mb_isword_class(utf_class(*s), wp);
Karsten Hopp e230b9
  	if (enc_dbcs)
Karsten Hopp e230b9
! 	    return spell_mb_isword_class(
Karsten Hopp e230b9
! 				dbcs_class((unsigned)*s >> 8, *s & 0xff), wp);
Karsten Hopp e230b9
  	return 0;
Karsten Hopp e230b9
      }
Karsten Hopp e230b9
      return spelltab.st_isw[*s];
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 10193,10205 ****
Karsten Hopp e230b9
  	line = ml_get_curline();
Karsten Hopp e230b9
  	p = line + curwin->w_cursor.col;
Karsten Hopp e230b9
  	/* Backup to before start of word. */
Karsten Hopp e230b9
! 	while (p > line && spell_iswordp_nmw(p))
Karsten Hopp e230b9
  	    mb_ptr_back(line, p);
Karsten Hopp e230b9
  	/* Forward to start of word. */
Karsten Hopp e230b9
! 	while (*p != NUL && !spell_iswordp_nmw(p))
Karsten Hopp e230b9
  	    mb_ptr_adv(p);
Karsten Hopp e230b9
  
Karsten Hopp e230b9
! 	if (!spell_iswordp_nmw(p))		/* No word found. */
Karsten Hopp e230b9
  	{
Karsten Hopp e230b9
  	    beep_flush();
Karsten Hopp e230b9
  	    return;
Karsten Hopp e230b9
--- 10208,10220 ----
Karsten Hopp e230b9
  	line = ml_get_curline();
Karsten Hopp e230b9
  	p = line + curwin->w_cursor.col;
Karsten Hopp e230b9
  	/* Backup to before start of word. */
Karsten Hopp e230b9
! 	while (p > line && spell_iswordp_nmw(p, curwin))
Karsten Hopp e230b9
  	    mb_ptr_back(line, p);
Karsten Hopp e230b9
  	/* Forward to start of word. */
Karsten Hopp e230b9
! 	while (*p != NUL && !spell_iswordp_nmw(p, curwin))
Karsten Hopp e230b9
  	    mb_ptr_adv(p);
Karsten Hopp e230b9
  
Karsten Hopp e230b9
! 	if (!spell_iswordp_nmw(p, curwin))		/* No word found. */
Karsten Hopp e230b9
  	{
Karsten Hopp e230b9
  	    beep_flush();
Karsten Hopp e230b9
  	    return;
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 10436,10442 ****
Karsten Hopp e230b9
  	for (;;)
Karsten Hopp e230b9
  	{
Karsten Hopp e230b9
  	    mb_ptr_back(line, p);
Karsten Hopp e230b9
! 	    if (p == line || spell_iswordp_nmw(p))
Karsten Hopp e230b9
  		break;
Karsten Hopp e230b9
  	    if (vim_regexec(&regmatch, p, 0)
Karsten Hopp e230b9
  					 && regmatch.endp[0] == line + endcol)
Karsten Hopp e230b9
--- 10451,10457 ----
Karsten Hopp e230b9
  	for (;;)
Karsten Hopp e230b9
  	{
Karsten Hopp e230b9
  	    mb_ptr_back(line, p);
Karsten Hopp e230b9
! 	    if (p == line || spell_iswordp_nmw(p, curwin))
Karsten Hopp e230b9
  		break;
Karsten Hopp e230b9
  	    if (vim_regexec(&regmatch, p, 0)
Karsten Hopp e230b9
  					 && regmatch.endp[0] == line + endcol)
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 11645,11651 ****
Karsten Hopp e230b9
  
Karsten Hopp e230b9
  		/* When appending a compound word after a word character don't
Karsten Hopp e230b9
  		 * use Onecap. */
Karsten Hopp e230b9
! 		if (p != NULL && spell_iswordp_nmw(p))
Karsten Hopp e230b9
  		    c &= ~WF_ONECAP;
Karsten Hopp e230b9
  		make_case_word(tword + sp->ts_splitoff,
Karsten Hopp e230b9
  					      preword + sp->ts_prewordlen, c);
Karsten Hopp e230b9
--- 11660,11666 ----
Karsten Hopp e230b9
  
Karsten Hopp e230b9
  		/* When appending a compound word after a word character don't
Karsten Hopp e230b9
  		 * use Onecap. */
Karsten Hopp e230b9
! 		if (p != NULL && spell_iswordp_nmw(p, curwin))
Karsten Hopp e230b9
  		    c &= ~WF_ONECAP;
Karsten Hopp e230b9
  		make_case_word(tword + sp->ts_splitoff,
Karsten Hopp e230b9
  					      preword + sp->ts_prewordlen, c);
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 11895,11901 ****
Karsten Hopp e230b9
  			 * character when the word ends.  But only when the
Karsten Hopp e230b9
  			 * good word can end. */
Karsten Hopp e230b9
  			if (((!try_compound && !spell_iswordp_nmw(fword
Karsten Hopp e230b9
! 							       + sp->ts_fidx))
Karsten Hopp e230b9
  				    || fword_ends)
Karsten Hopp e230b9
  				&& fword[sp->ts_fidx] != NUL
Karsten Hopp e230b9
  				&& goodword_ends)
Karsten Hopp e230b9
--- 11910,11917 ----
Karsten Hopp e230b9
  			 * character when the word ends.  But only when the
Karsten Hopp e230b9
  			 * good word can end. */
Karsten Hopp e230b9
  			if (((!try_compound && !spell_iswordp_nmw(fword
Karsten Hopp e230b9
! 							       + sp->ts_fidx,
Karsten Hopp e230b9
! 							       curwin))
Karsten Hopp e230b9
  				    || fword_ends)
Karsten Hopp e230b9
  				&& fword[sp->ts_fidx] != NUL
Karsten Hopp e230b9
  				&& goodword_ends)
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 14226,14232 ****
Karsten Hopp e230b9
  	    }
Karsten Hopp e230b9
  	    else
Karsten Hopp e230b9
  	    {
Karsten Hopp e230b9
! 		if (spell_iswordp_nmw(s))
Karsten Hopp e230b9
  		    *t++ = *s;
Karsten Hopp e230b9
  		++s;
Karsten Hopp e230b9
  	    }
Karsten Hopp e230b9
--- 14242,14248 ----
Karsten Hopp e230b9
  	    }
Karsten Hopp e230b9
  	    else
Karsten Hopp e230b9
  	    {
Karsten Hopp e230b9
! 		if (spell_iswordp_nmw(s, curwin))
Karsten Hopp e230b9
  		    *t++ = *s;
Karsten Hopp e230b9
  		++s;
Karsten Hopp e230b9
  	    }
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 14521,14527 ****
Karsten Hopp e230b9
  	    else
Karsten Hopp e230b9
  	    {
Karsten Hopp e230b9
  		did_white = FALSE;
Karsten Hopp e230b9
! 		if (!spell_iswordp_nmw(t))
Karsten Hopp e230b9
  		    continue;
Karsten Hopp e230b9
  	    }
Karsten Hopp e230b9
  	}
Karsten Hopp e230b9
--- 14537,14543 ----
Karsten Hopp e230b9
  	    else
Karsten Hopp e230b9
  	    {
Karsten Hopp e230b9
  		did_white = FALSE;
Karsten Hopp e230b9
! 		if (!spell_iswordp_nmw(t, curwin))
Karsten Hopp e230b9
  		    continue;
Karsten Hopp e230b9
  	    }
Karsten Hopp e230b9
  	}
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 16045,16051 ****
Karsten Hopp e230b9
      for (p = line + startcol; p > line; )
Karsten Hopp e230b9
      {
Karsten Hopp e230b9
  	mb_ptr_back(line, p);
Karsten Hopp e230b9
! 	if (spell_iswordp_nmw(p))
Karsten Hopp e230b9
  	    break;
Karsten Hopp e230b9
      }
Karsten Hopp e230b9
  
Karsten Hopp e230b9
--- 16061,16067 ----
Karsten Hopp e230b9
      for (p = line + startcol; p > line; )
Karsten Hopp e230b9
      {
Karsten Hopp e230b9
  	mb_ptr_back(line, p);
Karsten Hopp e230b9
! 	if (spell_iswordp_nmw(p, curwin))
Karsten Hopp e230b9
  	    break;
Karsten Hopp e230b9
      }
Karsten Hopp e230b9
  
Karsten Hopp e230b9
*** ../vim-7.4.087/src/structs.h	2013-11-09 05:30:18.000000000 +0100
Karsten Hopp e230b9
--- src/structs.h	2013-11-12 03:55:50.000000000 +0100
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 1310,1315 ****
Karsten Hopp e230b9
--- 1310,1318 ----
Karsten Hopp e230b9
      regprog_T	*b_cap_prog;	/* program for 'spellcapcheck' */
Karsten Hopp e230b9
      char_u	*b_p_spf;	/* 'spellfile' */
Karsten Hopp e230b9
      char_u	*b_p_spl;	/* 'spelllang' */
Karsten Hopp e230b9
+ # ifdef FEAT_MBYTE
Karsten Hopp e230b9
+     int		b_cjk;		/* all CJK letters as OK */
Karsten Hopp e230b9
+ # endif
Karsten Hopp e230b9
  #endif
Karsten Hopp e230b9
  #if !defined(FEAT_SYN_HL) && !defined(FEAT_SPELL)
Karsten Hopp e230b9
      int		dummy;
Karsten Hopp e230b9
*** ../vim-7.4.087/src/version.c	2013-11-11 23:17:31.000000000 +0100
Karsten Hopp e230b9
--- src/version.c	2013-11-12 03:59:03.000000000 +0100
Karsten Hopp e230b9
***************
Karsten Hopp e230b9
*** 740,741 ****
Karsten Hopp e230b9
--- 740,743 ----
Karsten Hopp e230b9
  {   /* Add new patch number below this line */
Karsten Hopp e230b9
+ /**/
Karsten Hopp e230b9
+     88,
Karsten Hopp e230b9
  /**/
Karsten Hopp e230b9
Karsten Hopp e230b9
-- 
Karsten Hopp e230b9
THEOREM: VI is perfect.
Karsten Hopp e230b9
PROOF: VI in roman numerals is 6.  The natural numbers < 6 which divide 6 are
Karsten Hopp e230b9
1, 2, and 3. 1+2+3 = 6.  So 6 is a perfect number.  Therefore, VI is perfect.
Karsten Hopp e230b9
QED
Karsten Hopp e230b9
						    -- Arthur Tateishi
Karsten Hopp e230b9
Karsten Hopp e230b9
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp e230b9
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp e230b9
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp e230b9
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///