astepano / rpms / vim

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