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