Karsten Hopp 836e2b
To: vim-dev@vim.org
Karsten Hopp 836e2b
Subject: Patch 7.1.248
Karsten Hopp 836e2b
Fcc: outbox
Karsten Hopp 836e2b
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 836e2b
Mime-Version: 1.0
Karsten Hopp 836e2b
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 836e2b
Content-Transfer-Encoding: 8bit
Karsten Hopp 836e2b
------------
Karsten Hopp 836e2b
Karsten Hopp 836e2b
Patch 7.1.248
Karsten Hopp 836e2b
Problem:    Can't set the '" mark.  Can't know if setpos() was successful.
Karsten Hopp 836e2b
Solution:   Allow setting the '" mark with setpos().  Have setpos() return a
Karsten Hopp 836e2b
	    value indicating success/failure.
Karsten Hopp 836e2b
Files:	    runtime/doc/eval.txt, src/eval.c, src/mark.c
Karsten Hopp 836e2b
Karsten Hopp 836e2b
Karsten Hopp 836e2b
*** ../vim-7.1.247/runtime/doc/eval.txt	Sat Jan 12 16:45:25 2008
Karsten Hopp 836e2b
--- runtime/doc/eval.txt	Wed Feb 13 11:49:16 2008
Karsten Hopp 836e2b
***************
Karsten Hopp 836e2b
*** 1,4 ****
Karsten Hopp 836e2b
! *eval.txt*      For Vim version 7.1.  Last change: 2008 Jan 11
Karsten Hopp 836e2b
  
Karsten Hopp 836e2b
  
Karsten Hopp 836e2b
  		  VIM REFERENCE MANUAL    by Bram Moolenaar
Karsten Hopp 836e2b
--- 1,4 ----
Karsten Hopp 836e2b
! *eval.txt*      For Vim version 7.1.  Last change: 2008 Feb 13
Karsten Hopp 836e2b
  
Karsten Hopp 836e2b
  
Karsten Hopp 836e2b
  		  VIM REFERENCE MANUAL    by Bram Moolenaar
Karsten Hopp 836e2b
***************
Karsten Hopp 836e2b
*** 4523,4528 ****
Karsten Hopp 836e2b
--- 4528,4536 ----
Karsten Hopp 836e2b
  		character.  E.g., a position within a <Tab> or after the last
Karsten Hopp 836e2b
  		character.
Karsten Hopp 836e2b
  
Karsten Hopp 836e2b
+ 		Returns 0 when the position could be set, -1 otherwise.
Karsten Hopp 836e2b
+ 		An error message is given if {expr} is invalid.
Karsten Hopp 836e2b
+ 
Karsten Hopp 836e2b
  		Also see |getpos()|
Karsten Hopp 836e2b
  
Karsten Hopp 836e2b
  		This does not restore the preferred column for moving
Karsten Hopp 836e2b
*** ../vim-7.1.247/src/eval.c	Tue Jan 22 11:58:41 2008
Karsten Hopp 836e2b
--- src/eval.c	Wed Feb 13 11:54:09 2008
Karsten Hopp 836e2b
***************
Karsten Hopp 836e2b
*** 14776,14799 ****
Karsten Hopp 836e2b
      int		fnum;
Karsten Hopp 836e2b
      char_u	*name;
Karsten Hopp 836e2b
  
Karsten Hopp 836e2b
      name = get_tv_string_chk(argvars);
Karsten Hopp 836e2b
      if (name != NULL)
Karsten Hopp 836e2b
      {
Karsten Hopp 836e2b
  	if (list2fpos(&argvars[1], &pos, &fnum) == OK)
Karsten Hopp 836e2b
  	{
Karsten Hopp 836e2b
  	    --pos.col;
Karsten Hopp 836e2b
! 	    if (name[0] == '.')		/* cursor */
Karsten Hopp 836e2b
  	    {
Karsten Hopp 836e2b
  		if (fnum == curbuf->b_fnum)
Karsten Hopp 836e2b
  		{
Karsten Hopp 836e2b
  		    curwin->w_cursor = pos;
Karsten Hopp 836e2b
  		    check_cursor();
Karsten Hopp 836e2b
  		}
Karsten Hopp 836e2b
  		else
Karsten Hopp 836e2b
  		    EMSG(_(e_invarg));
Karsten Hopp 836e2b
  	    }
Karsten Hopp 836e2b
! 	    else if (name[0] == '\'')	/* mark */
Karsten Hopp 836e2b
! 		(void)setmark_pos(name[1], &pos, fnum);
Karsten Hopp 836e2b
  	    else
Karsten Hopp 836e2b
  		EMSG(_(e_invarg));
Karsten Hopp 836e2b
  	}
Karsten Hopp 836e2b
--- 14778,14808 ----
Karsten Hopp 836e2b
      int		fnum;
Karsten Hopp 836e2b
      char_u	*name;
Karsten Hopp 836e2b
  
Karsten Hopp 836e2b
+     rettv->vval.v_number = -1;
Karsten Hopp 836e2b
      name = get_tv_string_chk(argvars);
Karsten Hopp 836e2b
      if (name != NULL)
Karsten Hopp 836e2b
      {
Karsten Hopp 836e2b
  	if (list2fpos(&argvars[1], &pos, &fnum) == OK)
Karsten Hopp 836e2b
  	{
Karsten Hopp 836e2b
  	    --pos.col;
Karsten Hopp 836e2b
! 	    if (name[0] == '.' && name[1] == NUL)
Karsten Hopp 836e2b
  	    {
Karsten Hopp 836e2b
+ 		/* set cursor */
Karsten Hopp 836e2b
  		if (fnum == curbuf->b_fnum)
Karsten Hopp 836e2b
  		{
Karsten Hopp 836e2b
  		    curwin->w_cursor = pos;
Karsten Hopp 836e2b
  		    check_cursor();
Karsten Hopp 836e2b
+ 		    rettv->vval.v_number = 0;
Karsten Hopp 836e2b
  		}
Karsten Hopp 836e2b
  		else
Karsten Hopp 836e2b
  		    EMSG(_(e_invarg));
Karsten Hopp 836e2b
  	    }
Karsten Hopp 836e2b
! 	    else if (name[0] == '\'' && name[1] != NUL && name[2] == NUL)
Karsten Hopp 836e2b
! 	    {
Karsten Hopp 836e2b
! 		/* set mark */
Karsten Hopp 836e2b
! 		if (setmark_pos(name[1], &pos, fnum) == OK)
Karsten Hopp 836e2b
! 		    rettv->vval.v_number = 0;
Karsten Hopp 836e2b
! 	    }
Karsten Hopp 836e2b
  	    else
Karsten Hopp 836e2b
  		EMSG(_(e_invarg));
Karsten Hopp 836e2b
  	}
Karsten Hopp 836e2b
*** ../vim-7.1.247/src/mark.c	Thu Jan  3 20:21:34 2008
Karsten Hopp 836e2b
--- src/mark.c	Wed Feb 13 11:42:30 2008
Karsten Hopp 836e2b
***************
Karsten Hopp 836e2b
*** 79,84 ****
Karsten Hopp 836e2b
--- 79,90 ----
Karsten Hopp 836e2b
  	return OK;
Karsten Hopp 836e2b
      }
Karsten Hopp 836e2b
  
Karsten Hopp 836e2b
+     if (c == '"')
Karsten Hopp 836e2b
+     {
Karsten Hopp 836e2b
+ 	curbuf->b_last_cursor = *pos;
Karsten Hopp 836e2b
+ 	return OK;
Karsten Hopp 836e2b
+     }
Karsten Hopp 836e2b
+ 
Karsten Hopp 836e2b
      /* Allow setting '[ and '] for an autocommand that simulates reading a
Karsten Hopp 836e2b
       * file. */
Karsten Hopp 836e2b
      if (c == '[')
Karsten Hopp 836e2b
*** ../vim-7.1.247/src/version.c	Wed Feb 13 10:57:11 2008
Karsten Hopp 836e2b
--- src/version.c	Wed Feb 13 12:39:23 2008
Karsten Hopp 836e2b
***************
Karsten Hopp 836e2b
*** 668,669 ****
Karsten Hopp 836e2b
--- 668,671 ----
Karsten Hopp 836e2b
  {   /* Add new patch number below this line */
Karsten Hopp 836e2b
+ /**/
Karsten Hopp 836e2b
+     248,
Karsten Hopp 836e2b
  /**/
Karsten Hopp 836e2b
Karsten Hopp 836e2b
-- 
Karsten Hopp 836e2b
"Making it up?  Why should I want to make anything up?  Life's bad enough
Karsten Hopp 836e2b
as it is without wanting to invent any more of it."
Karsten Hopp 836e2b
		-- Marvin, the Paranoid Android in Douglas Adams'
Karsten Hopp 836e2b
		   "The Hitchhiker's Guide to the Galaxy"
Karsten Hopp 836e2b
Karsten Hopp 836e2b
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 836e2b
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 836e2b
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 836e2b
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///