summaryrefslogtreecommitdiffstats
path: root/gvim/vim-7.2/7.2.011
blob: 928f8d638ba29b9747202acc8c148fc82cdf544a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
To: vim-dev@vim.org
Subject: Patch 7.2.011
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.2.011
Problem:    Get an error when inserting a float value from the expression
	    register.
Solution:   Convert the Float to a String automatically in the same place
	    where a List would be converted to a String.
Files:	    src/eval.c


*** ../vim-7.2.010/src/eval.c	Mon Aug 25 04:48:21 2008
--- src/eval.c	Sun Sep  7 13:50:38 2008
***************
*** 1256,1278 ****
  
  /*
   * Top level evaluation function, returning a string.
   * Return pointer to allocated memory, or NULL for failure.
   */
      char_u *
! eval_to_string(arg, nextcmd, dolist)
      char_u	*arg;
      char_u	**nextcmd;
!     int		dolist;		/* turn List into sequence of lines */
  {
      typval_T	tv;
      char_u	*retval;
      garray_T	ga;
  
      if (eval0(arg, &tv, nextcmd, TRUE) == FAIL)
  	retval = NULL;
      else
      {
! 	if (dolist && tv.v_type == VAR_LIST)
  	{
  	    ga_init2(&ga, (int)sizeof(char), 80);
  	    if (tv.vval.v_list != NULL)
--- 1256,1281 ----
  
  /*
   * Top level evaluation function, returning a string.
+  * When "convert" is TRUE convert a List into a sequence of lines and convert
+  * a Float to a String.
   * Return pointer to allocated memory, or NULL for failure.
   */
      char_u *
! eval_to_string(arg, nextcmd, convert)
      char_u	*arg;
      char_u	**nextcmd;
!     int		convert;
  {
      typval_T	tv;
      char_u	*retval;
      garray_T	ga;
+     char_u	numbuf[NUMBUFLEN];
  
      if (eval0(arg, &tv, nextcmd, TRUE) == FAIL)
  	retval = NULL;
      else
      {
! 	if (convert && tv.v_type == VAR_LIST)
  	{
  	    ga_init2(&ga, (int)sizeof(char), 80);
  	    if (tv.vval.v_list != NULL)
***************
*** 1280,1285 ****
--- 1283,1295 ----
  	    ga_append(&ga, NUL);
  	    retval = (char_u *)ga.ga_data;
  	}
+ #ifdef FEAT_FLOAT
+ 	else if (convert && tv.v_type == VAR_FLOAT)
+ 	{
+ 	    vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", tv.vval.v_float);
+ 	    retval = vim_strsave(numbuf);
+ 	}
+ #endif
  	else
  	    retval = vim_strsave(get_tv_string(&tv));
  	clear_tv(&tv);
*** ../vim-7.2.010/src/version.c	Sat Sep  6 16:44:06 2008
--- src/version.c	Sun Sep  7 13:52:00 2008
***************
*** 678,679 ****
--- 678,681 ----
  {   /* Add new patch number below this line */
+ /**/
+     11,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
34. You laugh at people with 14400 baud modems.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///