neovim/neovim — pull request #1720 by fwalch (2014-12-23 09:16:28+00:00)
Title: [RFC] 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
```

Succeeds #906. Corrected a few mistakes in that PR. The original vim patch contains documentation changes, which are already in the runtime.

Original patch (without documentation change for brevity):
```diff
diff --git a/src/eval.c b/src/eval.c
--- a/src/eval.c
+++ b/src/eval.c
@@ -19231,20 +19231,30 @@ f_winrestview(argvars, rettv)
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");
+	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");
#ifdef FEAT_VIRTUALEDIT
-	curwin->w_cursor.coladd = get_dict_number(dict, (char_u *)"coladd");
-#endif
-	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"));
+	if (dict_find(dict, (char_u *)"coladd", -1) != NULL)
+	curwin->w_cursor.coladd = get_dict_number(dict, (char_u *)"coladd");
+#endif
+	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"));
#ifdef FEAT_DIFF
-	curwin->w_topfill = get_dict_number(dict, (char_u *)"topfill");
-#endif
-	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 *)"topfill", -1) != NULL)
+	curwin->w_topfill = get_dict_number(dict, (char_u *)"topfill");
+#endif
+	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/version.c b/src/version.c
--- a/src/version.c
+++ b/src/version.c
@@ -735,6 +735,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 311,
+/**/
310,
/**/
309,
```