From: Bram Moolenaar Date: Fri, 1 Jul 2016 21:14:02 +0000 (+0200) Subject: patch 7.4.1979 X-Git-Tag: v7.4.1979 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2acfbed9dbea990f129535de7ff3df360365130b;p=vim patch 7.4.1979 Problem: Getting value of binary option is wrong. (Kent Sibilev) Solution: Fix type cast. Add a test. --- diff --git a/src/option.c b/src/option.c index 47bbe733b..95f4c734a 100644 --- a/src/option.c +++ b/src/option.c @@ -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; } diff --git a/src/testdir/test_expr.vim b/src/testdir/test_expr.vim index f44e21660..067dbf24f 100644 --- a/src/testdir/test_expr.vim +++ b/src/testdir/test_expr.vim @@ -106,3 +106,26 @@ func Test_special_char() " The failure is only visible using valgrind. call assert_fails('echo "\') 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=\" + call assert_equal("\", &cedit) + set cpo= + call assert_equal("", &cpo) + set cpo=abcdefgi + call assert_equal("abcdefgi", &cpo) + set cpo&vim +endfunc diff --git a/src/version.c b/src/version.c index 1613a7222..1e9672bdb 100644 --- a/src/version.c +++ b/src/version.c @@ -758,6 +758,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1979, /**/ 1978, /**/