4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: Get an error when inserting a float value from the expression
13 Solution: Convert the Float to a String automatically in the same place
14 where a List would be converted to a String.
18 *** ../vim-7.2.010/src/eval.c Mon Aug 25 04:48:21 2008
19 --- src/eval.c Sun Sep 7 13:50:38 2008
24 * Top level evaluation function, returning a string.
25 * Return pointer to allocated memory, or NULL for failure.
28 ! eval_to_string(arg, nextcmd, dolist)
31 ! int dolist; /* turn List into sequence of lines */
37 if (eval0(arg, &tv, nextcmd, TRUE) == FAIL)
41 ! if (dolist && tv.v_type == VAR_LIST)
43 ga_init2(&ga, (int)sizeof(char), 80);
44 if (tv.vval.v_list != NULL)
48 * Top level evaluation function, returning a string.
49 + * When "convert" is TRUE convert a List into a sequence of lines and convert
50 + * a Float to a String.
51 * Return pointer to allocated memory, or NULL for failure.
54 ! eval_to_string(arg, nextcmd, convert)
62 + char_u numbuf[NUMBUFLEN];
64 if (eval0(arg, &tv, nextcmd, TRUE) == FAIL)
68 ! if (convert && tv.v_type == VAR_LIST)
70 ga_init2(&ga, (int)sizeof(char), 80);
71 if (tv.vval.v_list != NULL)
76 retval = (char_u *)ga.ga_data;
79 + else if (convert && tv.v_type == VAR_FLOAT)
81 + vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", tv.vval.v_float);
82 + retval = vim_strsave(numbuf);
86 retval = vim_strsave(get_tv_string(&tv));
88 *** ../vim-7.2.010/src/version.c Sat Sep 6 16:44:06 2008
89 --- src/version.c Sun Sep 7 13:52:00 2008
93 { /* Add new patch number below this line */
99 hundred-and-one symptoms of being an internet addict:
100 34. You laugh at people with 14400 baud modems.
102 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
103 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
104 \\\ download, build and distribute -- http://www.A-A-P.org ///
105 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///