]> granicus.if.org Git - vim/commitdiff
patch 8.0.0003 v8.0.0003
authorBram Moolenaar <Bram@vim.org>
Mon, 12 Sep 2016 17:51:11 +0000 (19:51 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 12 Sep 2016 17:51:11 +0000 (19:51 +0200)
Problem:    getwinvar() returns wrong Value of boolean and number options,
            especially non big endian systems. (James McCoy)
Solution:   Cast the pointer to long or int. (closes #1060)

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

index 93e3c391fd48122a6bbe7f11aa5bcd696724c9be..2d5f3b83a9c3418be83ad19f344ee344b84a20e9 100644 (file)
@@ -12363,8 +12363,10 @@ get_winbuf_options(int bufopt)
            {
                if (opt->flags & P_STRING)
                    dict_add_nr_str(d, opt->fullname, 0L, *(char_u **)varp);
+               else if (opt->flags & P_NUM)
+                   dict_add_nr_str(d, opt->fullname, *(long *)varp, NULL);
                else
-                   dict_add_nr_str(d, opt->fullname, *varp, NULL);
+                   dict_add_nr_str(d, opt->fullname, *(int *)varp, NULL);
            }
        }
     }
index 5c916e2dd710629e0a1041b26d9e38cfea1f90e6..1c9350c416d2ea4fae82498a3a5e07775de10b5d 100644 (file)
@@ -87,9 +87,17 @@ function Test_get_buf_options()
 endfunc
 
 function Test_get_win_options()
+  if has('folding')
+    set foldlevel=999
+  endif
+  set list
   let opts = getwinvar(1, '&')
   call assert_equal(v:t_dict, type(opts))
   call assert_equal(0, opts.linebreak)
+  call assert_equal(1, opts.list)
+  if has('folding')
+    call assert_equal(999, opts.foldlevel)
+  endif
   if has('signs')
     call assert_equal('auto', opts.signcolumn)
   endif
@@ -97,7 +105,12 @@ function Test_get_win_options()
   let opts = gettabwinvar(1, 1, '&')
   call assert_equal(v:t_dict, type(opts))
   call assert_equal(0, opts.linebreak)
+  call assert_equal(1, opts.list)
   if has('signs')
     call assert_equal('auto', opts.signcolumn)
   endif
+  set list&
+  if has('folding')
+    set foldlevel=0
+  endif
 endfunc
index 1b932fae4318dc4dc6467aefd6288a7e90241434..dcf02c288c2131489406df2fe3ad65e8a042cbef 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3,
 /**/
     2,
 /**/