To: vim_dev@googlegroups.com Subject: Patch 7.4.1979 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1979 (after 7.4.1976) Problem: Getting value of binary option is wrong. (Kent Sibilev) Solution: Fix type cast. Add a test. Files: src/option.c, src/testdir/test_expr.vim *** ../vim-7.4.1978/src/option.c 2016-07-01 18:16:47.497936191 +0200 --- src/option.c 2016-07-01 22:59:50.796750810 +0200 *************** *** 9102,9108 **** if ((int *)varp == &curbuf->b_changed) *numval = curbufIsChanged(); else ! *numval = (long) *(varnumber_T *)varp; } return 1; } --- 9102,9108 ---- if ((int *)varp == &curbuf->b_changed) *numval = curbufIsChanged(); else ! *numval = (long) *(int *)varp; } return 1; } *** ../vim-7.4.1978/src/testdir/test_expr.vim 2016-07-01 11:59:43.177876159 +0200 --- src/testdir/test_expr.vim 2016-07-01 23:08:37.852982718 +0200 *************** *** 106,108 **** --- 106,131 ---- " 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 *** ../vim-7.4.1978/src/version.c 2016-07-01 21:48:59.723149241 +0200 --- src/version.c 2016-07-01 23:03:42.081341449 +0200 *************** *** 760,761 **** --- 760,763 ---- { /* Add new patch number below this line */ + /**/ + 1979, /**/ -- If Microsoft would build a car... ... The airbag system would ask "are you SURE?" before deploying. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///