]> granicus.if.org Git - vim/commitdiff
patch 7.4.1979 v7.4.1979
authorBram Moolenaar <Bram@vim.org>
Fri, 1 Jul 2016 21:14:02 +0000 (23:14 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 1 Jul 2016 21:14:02 +0000 (23:14 +0200)
Problem:    Getting value of binary option is wrong. (Kent Sibilev)
Solution:   Fix type cast.  Add a test.

src/option.c
src/testdir/test_expr.vim
src/version.c

index 47bbe733b1271cb7a71eff69d96f54ed25a4da41..95f4c734ac3388054bfc12a76951fe8632efea82 100644 (file)
@@ -9102,7 +9102,7 @@ get_option_value(
        if ((int *)varp == &curbuf->b_changed)
            *numval = curbufIsChanged();
        else
-           *numval = (long) *(varnumber_T *)varp;
+           *numval = (long) *(int *)varp;
     }
     return 1;
 }
index f44e21660ce5c012a54217dc7e2ecb1690271767..067dbf24f63d325963652ebcb04c61b9b53f277d 100644 (file)
@@ -106,3 +106,26 @@ func Test_special_char()
   " The failure is only visible using valgrind.
   call assert_fails('echo "\<C-">')
 endfunc
+
+func Test_option_value()
+  " boolean
+  set bri
+  call assert_equal(1, &bri)
+  set nobri
+  call assert_equal(0, &bri)
+
+  " number
+  set ts=1
+  call assert_equal(1, &ts)
+  set ts=8
+  call assert_equal(8, &ts)
+
+  " string
+  exe "set cedit=\<Esc>"
+  call assert_equal("\<Esc>", &cedit)
+  set cpo=
+  call assert_equal("", &cpo)
+  set cpo=abcdefgi
+  call assert_equal("abcdefgi", &cpo)
+  set cpo&vim
+endfunc
index 1613a72224ef1927a63a5b7d7d79a42beb6f0a83..1e9672bdbea652bb5bec5d9893226487e928d2a2 100644 (file)
@@ -758,6 +758,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1979,
 /**/
     1978,
 /**/