Karsten Hopp fddbca
To: vim-dev@vim.org
Karsten Hopp fddbca
Subject: patch 7.0.219
Karsten Hopp fddbca
Fcc: outbox
Karsten Hopp fddbca
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp fddbca
Mime-Version: 1.0
Karsten Hopp fddbca
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp fddbca
Content-Transfer-Encoding: 8bit
Karsten Hopp fddbca
------------
Karsten Hopp fddbca
Karsten Hopp fddbca
Patch 7.0.219
Karsten Hopp fddbca
Problem:    When using the 'editexisting.vim' script and a file is being
Karsten Hopp fddbca
	    edited in another tab page the window is split.  The "+123"
Karsten Hopp fddbca
	    argument is not used.
Karsten Hopp fddbca
Solution:   Make the tab page with the file the current tab page.  Set
Karsten Hopp fddbca
	    v:swapcommand when starting up to the first "+123" or "-c" command
Karsten Hopp fddbca
	    line argument.
Karsten Hopp fddbca
Files:	    runtime/macros/editexisting.vim, src/main.c
Karsten Hopp fddbca
Karsten Hopp fddbca
Karsten Hopp fddbca
*** ../vim-7.0.218/runtime/macros/editexisting.vim	Sun Apr 30 20:33:40 2006
Karsten Hopp fddbca
--- runtime/macros/editexisting.vim	Sat Mar 17 22:21:30 2007
Karsten Hopp fddbca
***************
Karsten Hopp fddbca
*** 1,6 ****
Karsten Hopp fddbca
  " Vim Plugin:	Edit the file with an existing Vim if possible
Karsten Hopp fddbca
  " Maintainer:	Bram Moolenaar
Karsten Hopp fddbca
! " Last Change:	2006 Apr 30
Karsten Hopp fddbca
  
Karsten Hopp fddbca
  " This is a plugin, drop it in your (Unix) ~/.vim/plugin or (Win32)
Karsten Hopp fddbca
  " $VIM/vimfiles/plugin directory.  Or make a symbolic link, so that you
Karsten Hopp fddbca
--- 1,6 ----
Karsten Hopp fddbca
  " Vim Plugin:	Edit the file with an existing Vim if possible
Karsten Hopp fddbca
  " Maintainer:	Bram Moolenaar
Karsten Hopp fddbca
! " Last Change:	2007 Mar 17
Karsten Hopp fddbca
  
Karsten Hopp fddbca
  " This is a plugin, drop it in your (Unix) ~/.vim/plugin or (Win32)
Karsten Hopp fddbca
  " $VIM/vimfiles/plugin directory.  Or make a symbolic link, so that you
Karsten Hopp fddbca
***************
Karsten Hopp fddbca
*** 85,93 ****
Karsten Hopp fddbca
  " Function used on the server to make the file visible and possibly execute a
Karsten Hopp fddbca
  " command.
Karsten Hopp fddbca
  func! EditExisting(fname, command)
Karsten Hopp fddbca
!   let n = bufwinnr(a:fname)
Karsten Hopp fddbca
!   if n > 0
Karsten Hopp fddbca
!     exe n . "wincmd w"
Karsten Hopp fddbca
    else
Karsten Hopp fddbca
      exe "split " . escape(a:fname, ' #%"|')
Karsten Hopp fddbca
    endif
Karsten Hopp fddbca
--- 85,107 ----
Karsten Hopp fddbca
  " Function used on the server to make the file visible and possibly execute a
Karsten Hopp fddbca
  " command.
Karsten Hopp fddbca
  func! EditExisting(fname, command)
Karsten Hopp fddbca
!   " Get the window number of the file in the current tab page.
Karsten Hopp fddbca
!   let winnr = bufwinnr(a:fname)
Karsten Hopp fddbca
!   if winnr <= 0
Karsten Hopp fddbca
!     " Not found, look in other tab pages.
Karsten Hopp fddbca
!     let bufnr = bufnr(a:fname)
Karsten Hopp fddbca
!     for i in range(tabpagenr('$'))
Karsten Hopp fddbca
!       if index(tabpagebuflist(i + 1), bufnr) >= 0
Karsten Hopp fddbca
! 	" Make this tab page the current one and find the window number.
Karsten Hopp fddbca
! 	exe 'tabnext ' . (i + 1)
Karsten Hopp fddbca
! 	let winnr = bufwinnr(a:fname)
Karsten Hopp fddbca
! 	break;
Karsten Hopp fddbca
!       endif
Karsten Hopp fddbca
!     endfor
Karsten Hopp fddbca
!   endif
Karsten Hopp fddbca
! 
Karsten Hopp fddbca
!   if winnr > 0
Karsten Hopp fddbca
!     exe winnr . "wincmd w"
Karsten Hopp fddbca
    else
Karsten Hopp fddbca
      exe "split " . escape(a:fname, ' #%"|')
Karsten Hopp fddbca
    endif
Karsten Hopp fddbca
*** ../vim-7.0.218/src/main.c	Tue Feb 27 16:51:07 2007
Karsten Hopp fddbca
--- src/main.c	Sun Mar 18 21:51:48 2007
Karsten Hopp fddbca
***************
Karsten Hopp fddbca
*** 798,803 ****
Karsten Hopp fddbca
--- 798,808 ----
Karsten Hopp fddbca
      create_windows(&params);
Karsten Hopp fddbca
      TIME_MSG("opening buffers");
Karsten Hopp fddbca
  
Karsten Hopp fddbca
+ #ifdef FEAT_EVAL
Karsten Hopp fddbca
+     /* clear v:swapcommand */
Karsten Hopp fddbca
+     set_vim_var_string(VV_SWAPCOMMAND, NULL, -1);
Karsten Hopp fddbca
+ #endif
Karsten Hopp fddbca
+ 
Karsten Hopp fddbca
      /* Ex starts at last line of the file */
Karsten Hopp fddbca
      if (exmode_active)
Karsten Hopp fddbca
  	curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
Karsten Hopp fddbca
***************
Karsten Hopp fddbca
*** 2202,2207 ****
Karsten Hopp fddbca
--- 2207,2227 ----
Karsten Hopp fddbca
  	    argv_idx = 1;
Karsten Hopp fddbca
  	}
Karsten Hopp fddbca
      }
Karsten Hopp fddbca
+ 
Karsten Hopp fddbca
+ #ifdef FEAT_EVAL
Karsten Hopp fddbca
+     /* If there is a "+123" or "-c" command, set v:swapcommand to the first
Karsten Hopp fddbca
+      * one. */
Karsten Hopp fddbca
+     if (parmp->n_commands > 0)
Karsten Hopp fddbca
+     {
Karsten Hopp fddbca
+ 	p = alloc((unsigned)STRLEN(parmp->commands[0]) + 3);
Karsten Hopp fddbca
+ 	if (p != NULL)
Karsten Hopp fddbca
+ 	{
Karsten Hopp fddbca
+ 	    sprintf((char *)p, ":%s\r", parmp->commands[0]);
Karsten Hopp fddbca
+ 	    set_vim_var_string(VV_SWAPCOMMAND, p, -1);
Karsten Hopp fddbca
+ 	    vim_free(p);
Karsten Hopp fddbca
+ 	}
Karsten Hopp fddbca
+     }
Karsten Hopp fddbca
+ #endif
Karsten Hopp fddbca
  }
Karsten Hopp fddbca
  
Karsten Hopp fddbca
  /*
Karsten Hopp fddbca
*** ../vim-7.0.218/src/version.c	Thu Mar 15 22:54:51 2007
Karsten Hopp fddbca
--- src/version.c	Sun Mar 18 21:49:11 2007
Karsten Hopp fddbca
***************
Karsten Hopp fddbca
*** 668,669 ****
Karsten Hopp fddbca
--- 668,671 ----
Karsten Hopp fddbca
  {   /* Add new patch number below this line */
Karsten Hopp fddbca
+ /**/
Karsten Hopp fddbca
+     219,
Karsten Hopp fddbca
  /**/
Karsten Hopp fddbca
Karsten Hopp fddbca
-- 
Karsten Hopp fddbca
FATHER:    You only killed the bride's father - that's all -
Karsten Hopp fddbca
LAUNCELOT: Oh dear, I didn't really mean to...
Karsten Hopp fddbca
FATHER:    Didn't mean to?  You put your sword right through his head!
Karsten Hopp fddbca
LAUNCELOT: Gosh - Is he all right?
Karsten Hopp fddbca
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
Karsten Hopp fddbca
Karsten Hopp fddbca
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp fddbca
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp fddbca
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp fddbca
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///