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 / unreleased / patches / 5.6a.007 < prev    next >
Encoding:
Internet Message Format  |  1999-12-21  |  4.8 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 5.6a.007
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. ------------
  6.  
  7. Patch 5.6a.007
  8. Problem:    ":let" didn't show internal Vim variables.  (Ron Aaron)
  9. Solution:   Do show ":v" variables for ":let" and ":let v:name".
  10. Files:        src/eval.c
  11.  
  12.  
  13. *** ../vim-5.6a.6/src/eval.c    Tue Dec 21 13:01:11 1999
  14. --- src/eval.c    Wed Dec 22 10:37:53 1999
  15. ***************
  16. *** 229,234 ****
  17. --- 229,236 ----
  18.   static struct growarray *find_var_ga __ARGS((char_u *name, char_u **varname));
  19.   static void var_free_one __ARGS((VAR v));
  20.   static void list_one_var __ARGS((VAR v, char_u *prefix));
  21. + static void list_vim_var __ARGS((int i));
  22. + static void list_one_var_a __ARGS((char_u *prefix, char_u *name, int type, char_u *string));
  23.   static void set_var __ARGS((char_u *name, VAR varp));
  24.   static char_u *find_option_end __ARGS((char_u *p));
  25.   static void list_func_head __ARGS((struct ufunc *fp));
  26. ***************
  27. *** 353,358 ****
  28. --- 355,363 ----
  29.           for (i = 0; i < curwin->w_vars.ga_len; ++i)
  30.               if (WVAR_ENTRY(i).var_name != NULL)
  31.               list_one_var(&WVAR_ENTRY(i), (char_u *)"w:");
  32. +         for (i = 0; i < VV_LEN; ++i)
  33. +             if (vimvars[i].type == VAR_NUMBER || vimvars[i].val != NULL)
  34. +             list_vim_var(i);
  35.           }
  36.       }
  37.       else
  38. ***************
  39. *** 373,400 ****
  40.           {
  41.               c1 = *p;
  42.               *p = NUL;
  43. !             varp = find_var(arg, FALSE);
  44. !             if (varp == NULL)
  45. !             EMSG2("Unknown variable: \"%s\"", arg);
  46.               else
  47.               {
  48. !             name = vim_strchr(arg, ':');
  49. !             if (name != NULL)
  50.               {
  51. !                 /* "a:" vars have no name stored, use whole arg */
  52. !                 if (arg[0] == 'a' && arg[1] == ':')
  53. !                 c2 = NUL;
  54. !                 else
  55.                   {
  56. !                 c2 = *++name;
  57. !                 *name = NUL;
  58.                   }
  59. !                 list_one_var(varp, arg);
  60. !                 if (c2 != NUL)
  61. !                 *name = c2;
  62.               }
  63. -             else
  64. -                 list_one_var(varp, (char_u *)"");
  65.               }
  66.               *p = c1;
  67.           }
  68. --- 378,412 ----
  69.           {
  70.               c1 = *p;
  71.               *p = NUL;
  72. !             i = find_vim_var(arg, (int)(p - arg));
  73. !             if (i >= 0)
  74. !             list_vim_var(i);
  75.               else
  76.               {
  77. !             varp = find_var(arg, FALSE);
  78. !             if (varp == NULL)
  79. !                 EMSG2("Unknown variable: \"%s\"", arg);
  80. !             else
  81.               {
  82. !                 name = vim_strchr(arg, ':');
  83. !                 if (name != NULL)
  84.                   {
  85. !                 /* "a:" vars have no name stored, use whole
  86. !                  * arg */
  87. !                 if (arg[0] == 'a' && arg[1] == ':')
  88. !                     c2 = NUL;
  89. !                 else
  90. !                 {
  91. !                     c2 = *++name;
  92. !                     *name = NUL;
  93. !                 }
  94. !                 list_one_var(varp, arg);
  95. !                 if (c2 != NUL)
  96. !                     *name = c2;
  97.                   }
  98. !                 else
  99. !                 list_one_var(varp, (char_u *)"");
  100.               }
  101.               }
  102.               *p = c1;
  103.           }
  104. ***************
  105. *** 4465,4483 ****
  106.    */
  107.       static void
  108.   list_one_var(v, prefix)
  109. !     VAR        v;
  110. !     char_u  *prefix;
  111.   {
  112. !     msg(prefix);
  113. !     if (v->var_name != NULL)    /* "a:" vars don't have a name stored */
  114. !     msg_puts(v->var_name);
  115.       msg_putchar(' ');
  116.       msg_advance(22);
  117. !     if (v->var_type == VAR_NUMBER)
  118.       msg_putchar('#');
  119.       else
  120.       msg_putchar(' ');
  121. !     msg_outtrans(get_var_string(v));
  122.   }
  123.   
  124.   /*
  125. --- 4477,4527 ----
  126.    */
  127.       static void
  128.   list_one_var(v, prefix)
  129. !     VAR        v;
  130. !     char_u    *prefix;
  131. ! {
  132. !     list_one_var_a(prefix, v->var_name, v->var_type, get_var_string(v));
  133. ! }
  134. ! /*
  135. !  * List the value of one "v:" variable.
  136. !  */
  137. !     static void
  138. ! list_vim_var(i)
  139. !     int        i;    /* index in vimvars[] */
  140. ! {
  141. !     char_u    *p;
  142. !     char_u    numbuf[NUMBUFLEN];
  143. !     if (vimvars[i].type == VAR_NUMBER)
  144. !     {
  145. !     p = numbuf;
  146. !     sprintf((char *)p, "%ld", (long)vimvars[i].val);
  147. !     }
  148. !     else if (vimvars[i].val == NULL)
  149. !     p = (char_u *)"";
  150. !     else
  151. !     p = vimvars[i].val;
  152. !     list_one_var_a((char_u *)"v:", vimvars[i].name, vimvars[i].type, p);
  153. ! }
  154. !     static void
  155. ! list_one_var_a(prefix, name, type, string)
  156. !     char_u    *prefix;
  157. !     char_u    *name;
  158. !     int        type;
  159. !     char_u    *string;
  160.   {
  161. !     msg_attr(prefix, 0);    /* don't use msg(), it overwrites "v:statusmsg" */
  162. !     if (name != NULL)    /* "a:" vars don't have a name stored */
  163. !     msg_puts(name);
  164.       msg_putchar(' ');
  165.       msg_advance(22);
  166. !     if (type == VAR_NUMBER)
  167.       msg_putchar('#');
  168.       else
  169.       msg_putchar(' ');
  170. !     msg_outtrans(string);
  171.   }
  172.   
  173.   /*
  174. *** ../vim-5.6a.6/src/version.c    Tue Dec 21 21:48:28 1999
  175. --- src/version.c    Wed Dec 22 10:35:11 1999
  176. ***************
  177. *** 420,421 ****
  178. --- 420,423 ----
  179.   {   /* Add new patch number below this line */
  180. + /**/
  181. +     7,
  182.   /**/
  183.  
  184. -- 
  185. INSPECTOR END OF FILM: Move along.  There's nothing to see!  Keep moving!
  186.    [Suddenly he notices the cameras.]
  187. INSPECTOR END OF FILM: (to Camera) All right, put that away sonny.
  188.    [He walks over to it and puts his hand over the lens.]
  189.                  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
  190.  
  191. --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\--
  192.   \ \    www.vim.org/iccf      www.moolenaar.net       www.vim.org    / /
  193.