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