To: vim_dev@googlegroups.com Subject: Patch 8.0.0263 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0263 Problem: Farsi support is not tested enough. Solution: Add more tests for Farsi. Clean up the code. Files: src/farsi.c, src/testdir/test_farsi.vim *** ../vim-8.0.0262/src/farsi.c 2017-01-29 17:59:07.872772178 +0100 --- src/farsi.c 2017-01-29 18:18:48.621069472 +0100 *************** *** 1920,1975 **** 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 (c) --- 1920,1975 ---- 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 (c) *** ../vim-8.0.0262/src/testdir/test_farsi.vim 2017-01-29 17:59:07.876772153 +0100 --- src/testdir/test_farsi.vim 2017-01-29 19:52:38.848115773 +0100 *************** *** 91,103 **** call feedkeys("aabc0123456789.+-^%#=xyz\", '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 ` ! @ # $ % ^ & * () - _ = + \\ | : \" . / < > ? \", 'tx') ! call assert_equal("\x8cÌν®¥ª­«¦¹¸·¶µ´³²±°Ô\x93Õ¡ ô ú À ö æ ç Â [ ] ÷ ó ò ð õ ñ ¢ £  § ® ¤ ¥ ª ¬ è ¨© ­ é ½ « ë ê º » ¦  ¯ ¾ ¼ ¿ ", 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 ; \ , [ ] \", 'tx') ! call assert_equal("\x8cÌν®¥ª­«¦¹¸·¶µ´³²±°Ô\x93Õ¡ ô ú À ö æ ç Â [ ] ÷ ó ò ð õ ñ ¢ £  § ® ¤ ¥ ª ¬ è ¨© ­ é ½ « ë ê º » ¦  ¯ ¾ ¼ ¿ Ñ ù Ì Î Ï á þ Æ Ã Ü ø Á à Å ü Þ Ý Ä Ë Ë Ê É Ó Ù Ð û Ø Ö Í Í Ò Ô Ô × Õ ý Ú  ß Ç È ", getline('.')) bwipe! endfunc --- 91,133 ---- call feedkeys("aabc0123456789.+-^%#=xyz\", '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 ` ! @ # $ % ^ & * () - _ = + \\ | : \" . / < > ? \", 'tx') ! call assert_equal("¡ ô ú À ö æ ç Â [ ] ÷ ó ò ð õ ñ ¢ £  § ® ¤ ¥ ª ¬ è ¨© ­ é ½ « ë ê º » ¦  ¯ ¾ ¼ ¿ ", getline('.')) ! ! " all non-number special chars without spaces ! call feedkeys("oBEFHIKLMOPQRTUWY`!@#$%^&*()-_=+\\|:\"./<>?\",'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 ; \ , [ ] \", 'tx') ! call assert_equal("Ñ ù Ì Î Ï á þ Æ Ã Ü ø Á à Å ü Þ Ý Ä Ë Ë Ê É Ó Ù Ð û Ø Ö Í Í Ò Ô Ô × Õ ý Ú  ß Ç È ", getline('.')) ! ! " all letter chars without spaces ! call feedkeys("oaAbcCdDefgGhijJklmnNopqrsStuvVwxXyzZ;\,[]\", '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(":\"\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 ; \\ , [ ]\", 'tx') + call assert_equal("\"\x88 Ç ß ë Ú Õ Õ × Ô Ô Ò Í Í Ö Ø û Ð Ù Ó É Ê Ë Ë Ä Ý Þ ü Å à Á ø Ü Ã Æ þ á Ï Î Ì ù Ñ", getreg(':')) + + " letter characters without spaces + call feedkeys(":\"\aAbcCdDefgGhijJklmnNopqrsStuvVwxXyzZ;\\,[]\", '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(":\"\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\", 'tx') + call assert_equal("\"ñ õ ð ò ó ÷ ] [ Â ç æ ö À ú ô ¡ ê } { ¼ ¾ § ~ ® º è é ­ «  ¿ ë ½ ©¨ ¯ ¬ ª ¥ ¤ »  £  ¦ ¢ ¹ ¸ · ¶ µ ´ ³ ² ± °", getreg(':')) + + " other characters without spaces + call feedkeys(":\"\0123456789`.!\"$%^&/()=\\?+-_*:#~@<>{}|BEFHIKLMOPQRTUWY\", 'tx') + call assert_equal("\"ñõðòó÷][ÂçæöÀúô¡ê}{¼¾§~®ºèé­«¿ë½©¨¯¬ª¥¤»£¦¢¹¸·¶µ´³²±°", getreg(':')) + + set noallowrevins noaltkeymap + endfunc *** ../vim-8.0.0262/src/version.c 2017-01-29 17:59:07.876772153 +0100 --- src/version.c 2017-01-29 19:54:02.971552805 +0100 *************** *** 766,767 **** --- 766,769 ---- { /* Add new patch number below this line */ + /**/ + 263, /**/ -- There can't be a crisis today, my schedule is already full. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///