Karsten Hopp 872b3b
To: vim-dev@vim.org
Karsten Hopp 872b3b
Subject: Patch 7.1.293
Karsten Hopp 872b3b
Fcc: outbox
Karsten Hopp 872b3b
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 872b3b
Mime-Version: 1.0
Karsten Hopp 872b3b
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 872b3b
Content-Transfer-Encoding: 8bit
Karsten Hopp 872b3b
------------
Karsten Hopp 872b3b
Karsten Hopp 872b3b
Patch 7.1.293
Karsten Hopp 872b3b
Problem:    Spell checking considers super- and subscript characters as word
Karsten Hopp 872b3b
	    characters.
Karsten Hopp 872b3b
Solution:   Recognize the Unicode super and subscript characters.
Karsten Hopp 872b3b
Files:	    src/spell.c
Karsten Hopp 872b3b
Karsten Hopp 872b3b
Karsten Hopp 872b3b
*** ../vim-7.1.292/src/spell.c	Tue Apr  1 17:13:54 2008
Karsten Hopp 872b3b
--- src/spell.c	Wed Apr  9 15:47:06 2008
Karsten Hopp 872b3b
***************
Karsten Hopp 872b3b
*** 753,758 ****
Karsten Hopp 872b3b
--- 753,759 ----
Karsten Hopp 872b3b
  static int spell_iswordp __ARGS((char_u *p, buf_T *buf));
Karsten Hopp 872b3b
  static int spell_iswordp_nmw __ARGS((char_u *p));
Karsten Hopp 872b3b
  #ifdef FEAT_MBYTE
Karsten Hopp 872b3b
+ static int spell_mb_isword_class __ARGS((int cl));
Karsten Hopp 872b3b
  static int spell_iswordp_w __ARGS((int *p, buf_T *buf));
Karsten Hopp 872b3b
  #endif
Karsten Hopp 872b3b
  static int write_spell_prefcond __ARGS((FILE *fd, garray_T *gap));
Karsten Hopp 872b3b
***************
Karsten Hopp 872b3b
*** 9789,9795 ****
Karsten Hopp 872b3b
  
Karsten Hopp 872b3b
  	c = mb_ptr2char(s);
Karsten Hopp 872b3b
  	if (c > 255)
Karsten Hopp 872b3b
! 	    return mb_get_class(s) >= 2;
Karsten Hopp 872b3b
  	return spelltab.st_isw[c];
Karsten Hopp 872b3b
      }
Karsten Hopp 872b3b
  #endif
Karsten Hopp 872b3b
--- 9790,9796 ----
Karsten Hopp 872b3b
  
Karsten Hopp 872b3b
  	c = mb_ptr2char(s);
Karsten Hopp 872b3b
  	if (c > 255)
Karsten Hopp 872b3b
! 	    return spell_mb_isword_class(mb_get_class(s));
Karsten Hopp 872b3b
  	return spelltab.st_isw[c];
Karsten Hopp 872b3b
      }
Karsten Hopp 872b3b
  #endif
Karsten Hopp 872b3b
***************
Karsten Hopp 872b3b
*** 9812,9818 ****
Karsten Hopp 872b3b
      {
Karsten Hopp 872b3b
  	c = mb_ptr2char(p);
Karsten Hopp 872b3b
  	if (c > 255)
Karsten Hopp 872b3b
! 	    return mb_get_class(p) >= 2;
Karsten Hopp 872b3b
  	return spelltab.st_isw[c];
Karsten Hopp 872b3b
      }
Karsten Hopp 872b3b
  #endif
Karsten Hopp 872b3b
--- 9813,9819 ----
Karsten Hopp 872b3b
      {
Karsten Hopp 872b3b
  	c = mb_ptr2char(p);
Karsten Hopp 872b3b
  	if (c > 255)
Karsten Hopp 872b3b
! 	    return spell_mb_isword_class(mb_get_class(p));
Karsten Hopp 872b3b
  	return spelltab.st_isw[c];
Karsten Hopp 872b3b
      }
Karsten Hopp 872b3b
  #endif
Karsten Hopp 872b3b
***************
Karsten Hopp 872b3b
*** 9821,9826 ****
Karsten Hopp 872b3b
--- 9822,9839 ----
Karsten Hopp 872b3b
  
Karsten Hopp 872b3b
  #ifdef FEAT_MBYTE
Karsten Hopp 872b3b
  /*
Karsten Hopp 872b3b
+  * Return TRUE if word class indicates a word character.
Karsten Hopp 872b3b
+  * Only for characters above 255.
Karsten Hopp 872b3b
+  * Unicode subscript and superscript are not considered word characters.
Karsten Hopp 872b3b
+  */
Karsten Hopp 872b3b
+     static int
Karsten Hopp 872b3b
+ spell_mb_isword_class(cl)
Karsten Hopp 872b3b
+     int cl;
Karsten Hopp 872b3b
+ {
Karsten Hopp 872b3b
+     return cl >= 2 && cl != 0x2070 && cl != 0x2080;
Karsten Hopp 872b3b
+ }
Karsten Hopp 872b3b
+ 
Karsten Hopp 872b3b
+ /*
Karsten Hopp 872b3b
   * Return TRUE if "p" points to a word character.
Karsten Hopp 872b3b
   * Wide version of spell_iswordp().
Karsten Hopp 872b3b
   */
Karsten Hopp 872b3b
***************
Karsten Hopp 872b3b
*** 9841,9847 ****
Karsten Hopp 872b3b
      if (*s > 255)
Karsten Hopp 872b3b
      {
Karsten Hopp 872b3b
  	if (enc_utf8)
Karsten Hopp 872b3b
! 	    return utf_class(*s) >= 2;
Karsten Hopp 872b3b
  	if (enc_dbcs)
Karsten Hopp 872b3b
  	    return dbcs_class((unsigned)*s >> 8, *s & 0xff) >= 2;
Karsten Hopp 872b3b
  	return 0;
Karsten Hopp 872b3b
--- 9854,9860 ----
Karsten Hopp 872b3b
      if (*s > 255)
Karsten Hopp 872b3b
      {
Karsten Hopp 872b3b
  	if (enc_utf8)
Karsten Hopp 872b3b
! 	    return spell_mb_isword_class(utf_class(*s));
Karsten Hopp 872b3b
  	if (enc_dbcs)
Karsten Hopp 872b3b
  	    return dbcs_class((unsigned)*s >> 8, *s & 0xff) >= 2;
Karsten Hopp 872b3b
  	return 0;
Karsten Hopp 872b3b
*** ../vim-7.1.292/src/version.c	Wed Apr  9 12:14:44 2008
Karsten Hopp 872b3b
--- src/version.c	Wed Apr  9 15:45:10 2008
Karsten Hopp 872b3b
***************
Karsten Hopp 872b3b
*** 668,669 ****
Karsten Hopp 872b3b
--- 673,676 ----
Karsten Hopp 872b3b
  {   /* Add new patch number below this line */
Karsten Hopp 872b3b
+ /**/
Karsten Hopp 872b3b
+     293,
Karsten Hopp 872b3b
  /**/
Karsten Hopp 872b3b
Karsten Hopp 872b3b
-- 
Karsten Hopp 872b3b
hundred-and-one symptoms of being an internet addict:
Karsten Hopp 872b3b
268. You get up in the morning and go online before getting your coffee.
Karsten Hopp 872b3b
Karsten Hopp 872b3b
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 872b3b
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 872b3b
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 872b3b
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///