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