Permalink
Browse files

patch 8.0.0003

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)
  • Loading branch information...
1 parent b56e7ff commit 789a5c0e3d27f09456678f0cfb6c1bd2d8ab4a35 @brammool brammool committed Sep 12, 2016
Showing with 18 additions and 1 deletion.
  1. +3 −1 src/option.c
  2. +13 −0 src/testdir/test_bufwintabinfo.vim
  3. +2 −0 src/version.c
View
@@ -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);
}
}
}
@@ -87,17 +87,30 @@ 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
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
View
@@ -765,6 +765,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3,
+/**/
2,
/**/
1,

0 comments on commit 789a5c0

Please sign in to comment.