]> granicus.if.org Git - vim/commitdiff
patch 8.0.0263: Farsi support is not tested enough v8.0.0263
authorBram Moolenaar <Bram@vim.org>
Sun, 29 Jan 2017 18:59:39 +0000 (19:59 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 29 Jan 2017 18:59:39 +0000 (19:59 +0100)
Problem:    Farsi support is not tested enough.
Solution:   Add more tests for Farsi.  Clean up the code.

src/farsi.c
src/testdir/test_farsi.vim
src/version.c

index 682dd463028ea85b4cc152ecfc2a6a6d676fa2c5..cc414d617896d776317147311860f6fdb593b88e 100644 (file)
@@ -1920,56 +1920,56 @@ cmdl_fkmap(int c)
        case  NL:
        case  TAB:
 
-              switch ((tempc = cmd_gchar(AT_CURSOR)))
-              {
-           case _BE:
-           case _PE:
-           case _TE:
-           case _SE:
-           case _JIM:
-           case _CHE:
-           case _HE_J:
-           case _XE:
-           case _SIN:
-           case _SHIN:
-           case _SAD:
-           case _ZAD:
-           case _AYN:
-           case _GHAYN:
-           case _FE:
-           case _GHAF:
-           case _KAF:
-           case _GAF:
-           case _LAM:
-           case _MIM:
-           case _NOON:
-           case _HE:
-           case _HE_:
-                       cmd_pchar(toF_TyA(tempc), AT_CURSOR);
-               break;
-           case _AYN_:
-                       cmd_pchar(AYN_, AT_CURSOR);
-               break;
-           case _GHAYN_:
-                       cmd_pchar(GHAYN_, AT_CURSOR);
-               break;
-           case _IE:
-               if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR+1))
-                           cmd_pchar(IE_, AT_CURSOR);
-               else
-                           cmd_pchar(IE, AT_CURSOR);
-               break;
-           case _YEE:
-               if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR+1))
-                           cmd_pchar(YEE_, AT_CURSOR);
-                       else
-                           cmd_pchar(YEE, AT_CURSOR);
-               break;
-           case _YE:
-               if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR+1))
-                           cmd_pchar(YE_, AT_CURSOR);
-                       else
-                           cmd_pchar(YE, AT_CURSOR);
+           switch ((tempc = cmd_gchar(AT_CURSOR)))
+           {
+               case _BE:
+               case _PE:
+               case _TE:
+               case _SE:
+               case _JIM:
+               case _CHE:
+               case _HE_J:
+               case _XE:
+               case _SIN:
+               case _SHIN:
+               case _SAD:
+               case _ZAD:
+               case _AYN:
+               case _GHAYN:
+               case _FE:
+               case _GHAF:
+               case _KAF:
+               case _GAF:
+               case _LAM:
+               case _MIM:
+               case _NOON:
+               case _HE:
+               case _HE_:
+                   cmd_pchar(toF_TyA(tempc), AT_CURSOR);
+                   break;
+               case _AYN_:
+                   cmd_pchar(AYN_, AT_CURSOR);
+                   break;
+               case _GHAYN_:
+                   cmd_pchar(GHAYN_, AT_CURSOR);
+                   break;
+               case _IE:
+                   if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR+1))
+                       cmd_pchar(IE_, AT_CURSOR);
+                   else
+                       cmd_pchar(IE, AT_CURSOR);
+                   break;
+               case _YEE:
+                   if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR+1))
+                       cmd_pchar(YEE_, AT_CURSOR);
+                   else
+                       cmd_pchar(YEE, AT_CURSOR);
+                   break;
+               case _YE:
+                   if (F_is_TyB_TyC_TyD(SRC_CMD, AT_CURSOR+1))
+                       cmd_pchar(YE_, AT_CURSOR);
+                   else
+                       cmd_pchar(YE, AT_CURSOR);
            }
 
            switch (c)
index 9c165d7fb669ea7e8fa252ea21d1b4a2b215d8b3..dcfa0248c1c74cd9700f22cbe9e371fc4e374285 100644 (file)
@@ -91,13 +91,43 @@ func Test_input_farsi()
   call feedkeys("aabc0123456789.+-^%#=xyz\<Esc>", 'tx')
   call assert_equal("\x8cÌν®¥ª­«¦¹¸·¶µ´³²±°Ô\x93Õ", getline('.'))
 
-  " all non-number special chars
-  call feedkeys("aB E F H I K L M O P Q R T U W Y ` !  @ # $ % ^ & * () - _ = + \\ | : \" .  / < > ? \<Esc>", 'tx')
-  call assert_equal("\x8cÌν®¥ª­«¦¹¸·¶µ´³²±°Ô\x93Õ¡ ô ú À ö æ ç Â [ ] ÷ ó ò ð õ ñ ¢ £  § ® ¤ ¥ ª ¬ è ¨© ­ é ½ « ë ê º » ¦  ¯ ¾ ¼ ¿ ", getline('.'))
+  " all non-number special chars with spaces
+  call feedkeys("oB E F H I K L M O P Q R T U W Y ` !  @ # $ % ^ & * () - _ = + \\ | : \" .  / < > ? \<Esc>", 'tx')
+  call assert_equal("¡ ô ú À ö æ ç Â [ ] ÷ ó ò ð õ ñ ¢ £  § ® ¤ ¥ ª ¬ è ¨© ­ é ½ « ë ê º » ¦  ¯ ¾ ¼ ¿ ", getline('.'))
 
-  " all letter chars
-  call feedkeys("aa A b c C d D e f g G h i j J k l m n N o p q r s S t u v V w x X y z Z ; \ , [ ] \<Esc>", 'tx')
-  call assert_equal("\x8cÌν®¥ª­«¦¹¸·¶µ´³²±°Ô\x93Õ¡ ô ú À ö æ ç Â [ ] ÷ ó ò ð õ ñ ¢ £  § ® ¤ ¥ ª ¬ è ¨© ­ é ½ « ë ê º » ¦  ¯ ¾ ¼ ¿ Ñ ù Ì Î Ï á þ Æ Ã Ü ø Á à Å ü Þ Ý Ä Ë Ë Ê É Ó Ù Ð û Ø Ö Í Í Ò Ô Ô × Õ ý Ú  ß Ç È ", getline('.'))
+  " all non-number special chars without spaces
+  call feedkeys("oBEFHIKLMOPQRTUWY`!@#$%^&*()-_=+\\|:\"./<>?\<Esc>",'tx')
+  call assert_equal("¡ôúÀöæçÂ[]÷óòðõñ¢£§®¤¥ª¬è¨©­é½«ë꺻¦¯¾¼¿", getline('.'))
+
+  " all letter chars with spaces
+  call feedkeys("oa A b c C d D e f g G h i j J k l m n N o p q r s S t u v V w x X y z Z ; \ , [ ] \<Esc>", 'tx')
+  call assert_equal("Ñ ù Ì Î Ï á þ Æ Ã Ü ø Á à Å ü Þ Ý Ä Ë Ë Ê É Ó Ù Ð û Ø Ö Í Í Ò Ô Ô × Õ ý Ú  ß Ç È ", getline('.'))
+
+  " all letter chars without spaces
+  call feedkeys("oaAbcCdDefgGhijJklmnNopqrsStuvVwxXyzZ;\,[]\<Esc>", 'tx')
+  call assert_equal("\x8cùÌÎÏ\x9fî\x86\x83ÜøÁ\x9d\x85\x80\x9c\x9b\x84ËË\x8a\x89\x8e\x96\x8bì\x95\x90ÍÍ\x8dÔÔ\x93Õý\x97ß\x87\x88", getline('.'))
 
   bwipe!
 endfunc
+
+func Test_command_line_farsi()
+  set allowrevins altkeymap
+
+  " letter characters with spaces
+  call feedkeys(":\"\<C-_>a A b c C d D e f g G h i j J k l m n N o p q r s S t u v V w x X y z Z ; \\ , [ ]\<CR>", 'tx')
+  call assert_equal("\"\x88 Ç ß ë Ú Õ Õ × Ô Ô Ò Í Í Ö Ø û Ð Ù Ó É Ê Ë Ë Ä Ý Þ ü Å à Á ø Ü Ã Æ þ á Ï Î Ì ù Ñ", getreg(':'))
+  " letter characters without spaces
+  call feedkeys(":\"\<C-_>aAbcCdDefgGhijJklmnNopqrsStuvVwxXyzZ;\\,[]\<CR>", 'tx')
+  call assert_equal("\"\x88\x87ßëÚÕÕ\x93ÔÔ\x8dÍÍ\x90\x95ì\x8b\x96\x8e\x89\x8aËË\x84\x9b\x9c\x80\x85\x9dÁøÜ\x83\x86î\x9fÏÎÌù\x8c", getreg(':'))
+  " other characters with spaces
+  call feedkeys(":\"\<C-_>0 1 2 3 4 5 6 7 8 9 ` .  !  \" $ % ^ & / () = \\ ?  + - _ * : # ~ @ < > { } | B E F H I K L M O P Q R T U W Y\<CR>", 'tx')
+  call assert_equal("\"ñ õ ð ò ó ÷ ] [ Â ç æ ö À ú ô ¡ ê } { ¼ ¾ § ~ ® º è é ­ «  ¿ ë ½ ©¨ ¯ ¬ ª ¥ ¤ »  £  ¦ ¢ ¹ ¸ · ¶ µ ´ ³ ² ± °", getreg(':'))
+
+  " other characters without spaces
+  call feedkeys(":\"\<C-_>0123456789`.!\"$%^&/()=\\?+-_*:#~@<>{}|BEFHIKLMOPQRTUWY\<CR>", 'tx')
+  call assert_equal("\"ñõðòó÷][ÂçæöÀúô¡ê}{¼¾§~®ºèé­«¿ë½©¨¯¬ª¥¤»£¦¢¹¸·¶µ´³²±°", getreg(':'))
+
+  set noallowrevins noaltkeymap
+endfunc
index 17d9e631f79b09adc587204a2ed955271036780e..67fe69b7a8fa1b644b28f52edc004cbb1609319b 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    263,
 /**/
     262,
 /**/