Patch 7.1.248
Problem:    Can't set the '" mark.  Can't know if setpos() was successful.
Solution:   Allow setting the '" mark with setpos().  Have setpos() return a
            value indicating success/failure.
Files:      runtime/doc/eval.txt, src/eval.c, src/mark.c


*** ../vim-7.1.247/runtime/doc/eval.txt Sat Jan 12 16:45:25 2008
--- runtime/doc/eval.txt        Wed Feb 13 11:49:16 2008
***************
*** 1,4 ****
! *eval.txt*      For Vim version 7.1.  Last change: 2008 Jan 11
  
  
                  VIM REFERENCE MANUAL    by Bram Moolenaar
--- 1,4 ----
! *eval.txt*      For Vim version 7.1.  Last change: 2008 Feb 13
  
  
                  VIM REFERENCE MANUAL    by Bram Moolenaar
***************
*** 4523,4528 ****
--- 4528,4536 ----
                character.  E.g., a position within a <Tab> or after the last
                character.
  
+               Returns 0 when the position could be set, -1 otherwise.
+               An error message is given if {expr} is invalid.
+ 
                Also see |getpos()|
  
                This does not restore the preferred column for moving
*** ../vim-7.1.247/src/eval.c   Tue Jan 22 11:58:41 2008
--- src/eval.c  Wed Feb 13 11:54:09 2008
***************
*** 14776,14799 ****
      int               fnum;
      char_u    *name;
  
      name = get_tv_string_chk(argvars);
      if (name != NULL)
      {
        if (list2fpos(&argvars[1], &pos, &fnum) == OK)
        {
            --pos.col;
!           if (name[0] == '.')         /* cursor */
            {
                if (fnum == curbuf->b_fnum)
                {
                    curwin->w_cursor = pos;
                    check_cursor();
                }
                else
                    EMSG(_(e_invarg));
            }
!           else if (name[0] == '\'')   /* mark */
!               (void)setmark_pos(name[1], &pos, fnum);
            else
                EMSG(_(e_invarg));
        }
--- 14778,14808 ----
      int               fnum;
      char_u    *name;
  
+     rettv->vval.v_number = -1;
      name = get_tv_string_chk(argvars);
      if (name != NULL)
      {
        if (list2fpos(&argvars[1], &pos, &fnum) == OK)
        {
            --pos.col;
!           if (name[0] == '.' && name[1] == NUL)
            {
+               /* set cursor */
                if (fnum == curbuf->b_fnum)
                {
                    curwin->w_cursor = pos;
                    check_cursor();
+                   rettv->vval.v_number = 0;
                }
                else
                    EMSG(_(e_invarg));
            }
!           else if (name[0] == '\'' && name[1] != NUL && name[2] == NUL)
!           {
!               /* set mark */
!               if (setmark_pos(name[1], &pos, fnum) == OK)
!                   rettv->vval.v_number = 0;
!           }
            else
                EMSG(_(e_invarg));
        }
*** ../vim-7.1.247/src/mark.c   Thu Jan  3 20:21:34 2008
--- src/mark.c  Wed Feb 13 11:42:30 2008
***************
*** 79,84 ****
--- 79,90 ----
        return OK;
      }
  
+     if (c == '"')
+     {
+       curbuf->b_last_cursor = *pos;
+       return OK;
+     }
+ 
      /* Allow setting '[ and '] for an autocommand that simulates reading a
       * file. */
      if (c == '[')
*** ../vim-7.1.247/src/version.c        Wed Feb 13 10:57:11 2008
--- src/version.c       Wed Feb 13 12:39:23 2008
***************
*** 668,669 ****
--- 668,671 ----
  {   /* Add new patch number below this line */
+ /**/
+     248,
  /**/

-- 
"Making it up?  Why should I want to make anything up?  Life's bad enough
as it is without wanting to invent any more of it."
                -- Marvin, the Paranoid Android in Douglas Adams'
                   "The Hitchhiker's Guide to the Galaxy"

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui