home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 6.0.261 < prev    next >
Encoding:
Internet Message Format  |  2002-02-21  |  4.2 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.0.261
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 6.0.261
  11. Problem:    nr2char() and char2nr() don't work with multi-byte characters.
  12. Solution:   Use 'encoding' for these functions. (Yasuhiro Matsumoto)
  13. Files:        runtime/doc/eval.txt, src/eval.c
  14.  
  15.  
  16. *** ../vim60.260/runtime/doc/eval.txt    Mon Feb 18 12:58:16 2002
  17. --- runtime/doc/eval.txt    Fri Feb 22 14:14:08 2002
  18. ***************
  19. *** 1,4 ****
  20. ! *eval.txt*      For Vim version 6.0.  Last change: 2002 Feb 18
  21.   
  22.   
  23.             VIM REFERENCE MANUAL    by Bram Moolenaar
  24. --- 1,4 ----
  25. ! *eval.txt*      For Vim version 6.0.  Last change: 2002 Feb 22
  26.   
  27.   
  28.             VIM REFERENCE MANUAL    by Bram Moolenaar
  29. ***************
  30. *** 969,978 ****
  31.           feature}
  32.   
  33.   char2nr({expr})                        *char2nr()*
  34. !         Return ASCII value of the first char in {expr}.  Examples: >
  35.               char2nr(" ")        returns 32
  36.               char2nr("ABC")        returns 65
  37. ! <
  38.   cindent({lnum})                        *cindent()*
  39.           Get the amount of indent for line {lnum} according the C
  40.           indenting rules, as with 'cindent'.
  41. --- 991,1003 ----
  42.           feature}
  43.   
  44.   char2nr({expr})                        *char2nr()*
  45. !         Return number value of the first char in {expr}.  Examples: >
  46.               char2nr(" ")        returns 32
  47.               char2nr("ABC")        returns 65
  48. ! <        The current 'encoding' is used.  Example for "utf-8": >
  49. !             char2nr("ß")        returns 225
  50. !             char2nr("ß"[0])        returns 195
  51.   cindent({lnum})                        *cindent()*
  52.           Get the amount of indent for line {lnum} according the C
  53.           indenting rules, as with 'cindent'.
  54. ***************
  55. *** 1874,1884 ****
  56.           See also |prevnonblank()|.
  57.   
  58.   nr2char({expr})                        *nr2char()*
  59. !         Return a string with a single character, which has the ASCII
  60.           value {expr}.  Examples: >
  61.               nr2char(64)        returns "@"
  62.               nr2char(32)        returns " "
  63. ! <
  64.   prevnonblank({lnum})                    *prevnonblank()*
  65.           Return the line number of the first line at or above {lnum}
  66.           that is not blank.  Example: >
  67. --- 1893,1905 ----
  68.           See also |prevnonblank()|.
  69.   
  70.   nr2char({expr})                        *nr2char()*
  71. !         Return a string with a single character, which has the number
  72.           value {expr}.  Examples: >
  73.               nr2char(64)        returns "@"
  74.               nr2char(32)        returns " "
  75. ! <        The current 'encoding' is used.  Example for "utf-8": >
  76. !             nr2char(300)        returns I with bow character
  77.   prevnonblank({lnum})                    *prevnonblank()*
  78.           Return the line number of the first line at or above {lnum}
  79.           that is not blank.  Example: >
  80. *** ../vim60.260/src/eval.c    Thu Feb 21 16:37:34 2002
  81. --- src/eval.c    Fri Feb 22 14:03:05 2002
  82. ***************
  83. *** 3047,3052 ****
  84. --- 3047,3058 ----
  85.       VAR        argvars;
  86.       VAR        retvar;
  87.   {
  88. + #ifdef FEAT_MBYTE
  89. +     if (has_mbyte)
  90. +     retvar->var_val.var_number =
  91. +                   (*mb_ptr2char)(get_var_string(&argvars[0]));
  92. +     else
  93. + #endif
  94.       retvar->var_val.var_number = get_var_string(&argvars[0])[0];
  95.   }
  96.   
  97. ***************
  98. *** 5126,5136 ****
  99.       VAR        argvars;
  100.       VAR        retvar;
  101.   {
  102. !     char_u    buf[2];
  103.   
  104. !     buf[0] = (char_u)get_var_number(&argvars[0]);
  105.       retvar->var_type = VAR_STRING;
  106. !     retvar->var_val.var_string = vim_strnsave(buf, 1);
  107.   }
  108.   
  109.   /*
  110. --- 5132,5150 ----
  111.       VAR        argvars;
  112.       VAR        retvar;
  113.   {
  114. !     char_u    buf[NUMBUFLEN];
  115.   
  116. ! #ifdef FEAT_MBYTE
  117. !     if (has_mbyte)
  118. !     buf[(*mb_char2bytes)((int)get_var_number(&argvars[0]), buf)] = NUL;
  119. !     else
  120. ! #endif
  121. !     {
  122. !     buf[0] = (char_u)get_var_number(&argvars[0]);
  123. !     buf[1] = NUL;
  124. !     }
  125.       retvar->var_type = VAR_STRING;
  126. !     retvar->var_val.var_string = vim_strsave(buf);
  127.   }
  128.   
  129.   /*
  130. *** ../vim60.260/src/version.c    Fri Feb 22 12:33:04 2002
  131. --- src/version.c    Fri Feb 22 13:06:17 2002
  132. ***************
  133. *** 608,609 ****
  134. --- 608,611 ----
  135.   {   /* Add new patch number below this line */
  136. + /**/
  137. +     261,
  138.   /**/
  139.  
  140. -- 
  141. The average life of an organization chart is six months.  You can safely
  142. ignore any order from your boss that would take six months to complete.
  143.                 (Scott Adams - The Dilbert principle)
  144.  
  145.  ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
  146. ///   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   \\\
  147. \\\           Project leader for A-A-P -- http://www.a-a-p.org           ///
  148.  \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///
  149.