3ef2ca
To: vim_dev@googlegroups.com
3ef2ca
Subject: Patch 7.4.311
3ef2ca
Fcc: outbox
3ef2ca
From: Bram Moolenaar <Bram@moolenaar.net>
3ef2ca
Mime-Version: 1.0
3ef2ca
Content-Type: text/plain; charset=UTF-8
3ef2ca
Content-Transfer-Encoding: 8bit
3ef2ca
------------
3ef2ca
3ef2ca
Patch 7.4.311
3ef2ca
Problem:    Can't use winrestview to only restore part of the view.
3ef2ca
Solution:   Handle missing items in the dict. (Christian Brabandt)
3ef2ca
Files:	    src/eval.c, runtime/doc/eval.txt
3ef2ca
3ef2ca
3ef2ca
*** ../vim-7.4.310/src/eval.c	2014-05-28 14:32:47.156104334 +0200
3ef2ca
--- src/eval.c	2014-05-28 16:42:25.196172421 +0200
3ef2ca
***************
3ef2ca
*** 19231,19250 ****
3ef2ca
  	EMSG(_(e_invarg));
3ef2ca
      else
3ef2ca
      {
3ef2ca
! 	curwin->w_cursor.lnum = get_dict_number(dict, (char_u *)"lnum");
3ef2ca
! 	curwin->w_cursor.col = get_dict_number(dict, (char_u *)"col");
3ef2ca
  #ifdef FEAT_VIRTUALEDIT
3ef2ca
! 	curwin->w_cursor.coladd = get_dict_number(dict, (char_u *)"coladd");
3ef2ca
  #endif
3ef2ca
! 	curwin->w_curswant = get_dict_number(dict, (char_u *)"curswant");
3ef2ca
! 	curwin->w_set_curswant = FALSE;
3ef2ca
  
3ef2ca
! 	set_topline(curwin, get_dict_number(dict, (char_u *)"topline"));
3ef2ca
  #ifdef FEAT_DIFF
3ef2ca
! 	curwin->w_topfill = get_dict_number(dict, (char_u *)"topfill");
3ef2ca
  #endif
3ef2ca
! 	curwin->w_leftcol = get_dict_number(dict, (char_u *)"leftcol");
3ef2ca
! 	curwin->w_skipcol = get_dict_number(dict, (char_u *)"skipcol");
3ef2ca
  
3ef2ca
  	check_cursor();
3ef2ca
  	win_new_height(curwin, curwin->w_height);
3ef2ca
--- 19231,19260 ----
3ef2ca
  	EMSG(_(e_invarg));
3ef2ca
      else
3ef2ca
      {
3ef2ca
! 	if (dict_find(dict, (char_u *)"lnum", -1) != NULL)
3ef2ca
! 	    curwin->w_cursor.lnum = get_dict_number(dict, (char_u *)"lnum");
3ef2ca
! 	if (dict_find(dict, (char_u *)"col", -1) != NULL)
3ef2ca
! 	    curwin->w_cursor.col = get_dict_number(dict, (char_u *)"col");
3ef2ca
  #ifdef FEAT_VIRTUALEDIT
3ef2ca
! 	if (dict_find(dict, (char_u *)"coladd", -1) != NULL)
3ef2ca
! 	    curwin->w_cursor.coladd = get_dict_number(dict, (char_u *)"coladd");
3ef2ca
  #endif
3ef2ca
! 	if (dict_find(dict, (char_u *)"curswant", -1) != NULL)
3ef2ca
! 	{
3ef2ca
! 	    curwin->w_curswant = get_dict_number(dict, (char_u *)"curswant");
3ef2ca
! 	    curwin->w_set_curswant = FALSE;
3ef2ca
! 	}
3ef2ca
  
3ef2ca
! 	if (dict_find(dict, (char_u *)"topline", -1) != NULL)
3ef2ca
! 	    set_topline(curwin, get_dict_number(dict, (char_u *)"topline"));
3ef2ca
  #ifdef FEAT_DIFF
3ef2ca
! 	if (dict_find(dict, (char_u *)"topfill", -1) != NULL)
3ef2ca
! 	    curwin->w_topfill = get_dict_number(dict, (char_u *)"topfill");
3ef2ca
  #endif
3ef2ca
! 	if (dict_find(dict, (char_u *)"leftcol", -1) != NULL)
3ef2ca
! 	    curwin->w_leftcol = get_dict_number(dict, (char_u *)"leftcol");
3ef2ca
! 	if (dict_find(dict, (char_u *)"skipcol", -1) != NULL)
3ef2ca
! 	    curwin->w_skipcol = get_dict_number(dict, (char_u *)"skipcol");
3ef2ca
  
3ef2ca
  	check_cursor();
3ef2ca
  	win_new_height(curwin, curwin->w_height);
3ef2ca
*** ../vim-7.4.310/runtime/doc/eval.txt	2014-05-28 14:32:47.164104334 +0200
3ef2ca
--- runtime/doc/eval.txt	2014-05-28 16:42:25.192172421 +0200
3ef2ca
***************
3ef2ca
*** 6404,6409 ****
3ef2ca
--- 6414,6429 ----
3ef2ca
  winrestview({dict})
3ef2ca
  		Uses the |Dictionary| returned by |winsaveview()| to restore
3ef2ca
  		the view of the current window.
3ef2ca
+ 		Note: The {dict} does not have to contain all values, that are
3ef2ca
+ 		returned by |winsaveview()|. If values are missing, those
3ef2ca
+ 		settings won't be restored. So you can use: >
3ef2ca
+ 		    :call winrestview({'curswant': 4})
3ef2ca
+ <
3ef2ca
+ 		This will only set the curswant value (the column the cursor
3ef2ca
+ 		wants to move on vertical movements) of the cursor to column 5
3ef2ca
+ 		(yes, that is 5), while all other settings will remain the
3ef2ca
+ 		same. This is useful, if you set the cursor position manually.
3ef2ca
+ 
3ef2ca
  		If you have changed the values the result is unpredictable.
3ef2ca
  		If the window size changed the result won't be the same.
3ef2ca
  
3ef2ca
***************
3ef2ca
*** 6418,6424 ****
3ef2ca
  		not opened when moving around.
3ef2ca
  		The return value includes:
3ef2ca
  			lnum		cursor line number
3ef2ca
! 			col		cursor column
3ef2ca
  			coladd		cursor column offset for 'virtualedit'
3ef2ca
  			curswant	column for vertical movement
3ef2ca
  			topline		first line in the window
3ef2ca
--- 6438,6446 ----
3ef2ca
  		not opened when moving around.
3ef2ca
  		The return value includes:
3ef2ca
  			lnum		cursor line number
3ef2ca
! 			col		cursor column (Note: the first column
3ef2ca
! 					zero, as opposed to what getpos()
3ef2ca
! 					returns)
3ef2ca
  			coladd		cursor column offset for 'virtualedit'
3ef2ca
  			curswant	column for vertical movement
3ef2ca
  			topline		first line in the window
3ef2ca
*** ../vim-7.4.310/src/version.c	2014-05-28 14:32:47.164104334 +0200
3ef2ca
--- src/version.c	2014-05-28 16:45:19.200173944 +0200
3ef2ca
***************
3ef2ca
*** 736,737 ****
3ef2ca
--- 736,739 ----
3ef2ca
  {   /* Add new patch number below this line */
3ef2ca
+ /**/
3ef2ca
+     311,
3ef2ca
  /**/
3ef2ca
3ef2ca
-- 
3ef2ca
Your fault: core dumped
3ef2ca
3ef2ca
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
3ef2ca
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
3ef2ca
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
3ef2ca
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///