diff options
author | David Rodriguez <dissonance27@gmail.com> | 2014-06-30 17:58:56 -0400 |
---|---|---|
committer | Florian Walch <florian@fwalch.com> | 2014-12-23 10:13:13 +0100 |
commit | c824e7b2d2c9ef7fc97049c094e00f26adb43550 (patch) | |
tree | e2e827b5bae7c36fa5698b1bcfce8c592ab46d45 | |
parent | c3de63bfbc168cd8ccc53dbb3e587043c11f7276 (diff) | |
download | rneovim-c824e7b2d2c9ef7fc97049c094e00f26adb43550.tar.gz rneovim-c824e7b2d2c9ef7fc97049c094e00f26adb43550.tar.bz2 rneovim-c824e7b2d2c9ef7fc97049c094e00f26adb43550.zip |
vim-patch:7.4.311
Problem: Can't use winrestview to only restore part of the view.
Solution: Handle missing items in the dict. (Christian Brabandt)
https://code.google.com/p/vim/source/detail?r=v7-4-311
-rw-r--r-- | src/nvim/eval.c | 35 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
2 files changed, 26 insertions, 11 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index d058e6ccae..f50a215559 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -15247,16 +15247,31 @@ static void f_winrestview(typval_T *argvars, typval_T *rettv) || (dict = argvars[0].vval.v_dict) == NULL) EMSG(_(e_invarg)); else { - curwin->w_cursor.lnum = get_dict_number(dict, (char_u *)"lnum"); - curwin->w_cursor.col = get_dict_number(dict, (char_u *)"col"); - curwin->w_cursor.coladd = get_dict_number(dict, (char_u *)"coladd"); - curwin->w_curswant = get_dict_number(dict, (char_u *)"curswant"); - curwin->w_set_curswant = FALSE; - - set_topline(curwin, get_dict_number(dict, (char_u *)"topline")); - curwin->w_topfill = get_dict_number(dict, (char_u *)"topfill"); - curwin->w_leftcol = get_dict_number(dict, (char_u *)"leftcol"); - curwin->w_skipcol = get_dict_number(dict, (char_u *)"skipcol"); + if (dict_find(dict, (char_u *)"lnum", -1) != NULL) { + curwin->w_cursor.lnum = get_dict_number(dict, (char_u *)"lnum"); + } + if (dict_find(dict, (char_u *)"col", -1) != NULL) { + curwin->w_cursor.col = get_dict_number(dict, (char_u *)"col"); + } + if (dict_find(dict, (char_u *)"coladd", -1) != NULL) { + curwin->w_cursor.coladd = get_dict_number(dict, (char_u *)"coladd"); + } + if (dict_find(dict, (char_u *)"curswant", -1) != NULL) { + curwin->w_curswant = get_dict_number(dict, (char_u *)"curswant"); + curwin->w_set_curswant = FALSE; + } + if (dict_find(dict, (char_u *)"topline", -1) != NULL) { + set_topline(curwin, get_dict_number(dict, (char_u *)"topline")); + } + if (dict_find(dict, (char_u *)"topfill", -1) != NULL) { + curwin->w_topfill = get_dict_number(dict, (char_u *)"topfill"); + } + if (dict_find(dict, (char_u *)"leftcol", -1) != NULL) { + curwin->w_leftcol = get_dict_number(dict, (char_u *)"leftcol"); + } + if (dict_find(dict, (char_u *)"skipcol", -1) != NULL) { + curwin->w_skipcol = get_dict_number(dict, (char_u *)"skipcol"); + } check_cursor(); win_new_height(curwin, curwin->w_height); diff --git a/src/nvim/version.c b/src/nvim/version.c index cd11dfe1d0..ae9151c972 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -426,7 +426,7 @@ static int included_patches[] = { 314, 313, 312, - //311, + 311, 310, 309, 308, |