components/vim/vim72-patches/7.2.041
changeset 198 172fc01ce997
equal deleted inserted replaced
197:fd801ec0737c 198:172fc01ce997
       
     1 To: [email protected]
       
     2 Subject: Patch 7.2.041
       
     3 Fcc: outbox
       
     4 From: Bram Moolenaar <[email protected]>
       
     5 Mime-Version: 1.0
       
     6 Content-Type: text/plain; charset=ISO-8859-1
       
     7 Content-Transfer-Encoding: 8bit
       
     8 ------------
       
     9 
       
    10 Patch 7.2.041
       
    11 Problem:    In diff mode, when using two tabs, each with two diffed buffers,
       
    12 	    editing a buffer of the other tab messes up the diff.  (Matt
       
    13 	    Mzyzik)
       
    14 Solution:   Only copy options from a window where the buffer was edited that
       
    15 	    doesn't have 'diff' set or is for the current tab page.
       
    16 	    Also fix that window options for a buffer are stored with the
       
    17 	    wrong window.
       
    18 Files:	    src/buffer.c, src/ex_cmds.c, src/ex_cmds2.c, src/ex_docmd.c,
       
    19 	    src/ex_getln.c, src/if_sniff.c, src/main.c, src/netbeans.c,
       
    20 	    src/normal.c, src/popupmnu.c, src/proto/buffer.pro,
       
    21 	    src/proto/ex_cmds.pro src/quickfix.c, src/window.c
       
    22 
       
    23 
       
    24 *** ../vim-7.2.040/src/buffer.c	Wed Nov 12 12:51:38 2008
       
    25 --- src/buffer.c	Wed Nov 12 17:45:01 2008
       
    26 ***************
       
    27 *** 33,39 ****
       
    28   static char_u	*fname_match __ARGS((regprog_T *prog, char_u *name));
       
    29   #endif
       
    30   static void	buflist_setfpos __ARGS((buf_T *buf, win_T *win, linenr_T lnum, colnr_T col, int copy_options));
       
    31 ! static wininfo_T *find_wininfo __ARGS((buf_T *buf));
       
    32   #ifdef UNIX
       
    33   static buf_T	*buflist_findname_stat __ARGS((char_u *ffname, struct stat *st));
       
    34   static int	otherfile_buf __ARGS((buf_T *buf, char_u *ffname, struct stat *stp));
       
    35 --- 33,39 ----
       
    36   static char_u	*fname_match __ARGS((regprog_T *prog, char_u *name));
       
    37   #endif
       
    38   static void	buflist_setfpos __ARGS((buf_T *buf, win_T *win, linenr_T lnum, colnr_T col, int copy_options));
       
    39 ! static wininfo_T *find_wininfo __ARGS((buf_T *buf, int skip_diff_buffer));
       
    40   #ifdef UNIX
       
    41   static buf_T	*buflist_findname_stat __ARGS((char_u *ffname, struct stat *st));
       
    42   static int	otherfile_buf __ARGS((buf_T *buf, char_u *ffname, struct stat *stp));
       
    43 ***************
       
    44 *** 1093,1099 ****
       
    45   #endif
       
    46   	    setpcmark();
       
    47   	    retval = do_ecmd(0, NULL, NULL, NULL, ECMD_ONE,
       
    48 ! 						  forceit ? ECMD_FORCEIT : 0);
       
    49   
       
    50   	    /*
       
    51   	     * do_ecmd() may create a new buffer, then we have to delete
       
    52 --- 1093,1099 ----
       
    53   #endif
       
    54   	    setpcmark();
       
    55   	    retval = do_ecmd(0, NULL, NULL, NULL, ECMD_ONE,
       
    56 ! 					  forceit ? ECMD_FORCEIT : 0, curwin);
       
    57   
       
    58   	    /*
       
    59   	     * do_ecmd() may create a new buffer, then we have to delete
       
    60 ***************
       
    61 *** 1316,1322 ****
       
    62       setpcmark();
       
    63       if (!cmdmod.keepalt)
       
    64   	curwin->w_alt_fnum = curbuf->b_fnum; /* remember alternate file */
       
    65 !     buflist_altfpos();			 /* remember curpos */
       
    66   
       
    67   #ifdef FEAT_VISUAL
       
    68       /* Don't restart Select mode after switching to another buffer. */
       
    69 --- 1316,1322 ----
       
    70       setpcmark();
       
    71       if (!cmdmod.keepalt)
       
    72   	curwin->w_alt_fnum = curbuf->b_fnum; /* remember alternate file */
       
    73 !     buflist_altfpos(curwin);			 /* remember curpos */
       
    74   
       
    75   #ifdef FEAT_VISUAL
       
    76       /* Don't restart Select mode after switching to another buffer. */
       
    77 ***************
       
    78 *** 2404,2425 ****
       
    79       return;
       
    80   }
       
    81   
       
    82   /*
       
    83    * Find info for the current window in buffer "buf".
       
    84    * If not found, return the info for the most recently used window.
       
    85    * Returns NULL when there isn't any info.
       
    86    */
       
    87       static wininfo_T *
       
    88 ! find_wininfo(buf)
       
    89       buf_T	*buf;
       
    90   {
       
    91       wininfo_T	*wip;
       
    92   
       
    93       for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next)
       
    94 ! 	if (wip->wi_win == curwin)
       
    95   	    break;
       
    96 !     if (wip == NULL)	/* if no fpos for curwin, use the first in the list */
       
    97 ! 	wip = buf->b_wininfo;
       
    98       return wip;
       
    99   }
       
   100   
       
   101 --- 2404,2473 ----
       
   102       return;
       
   103   }
       
   104   
       
   105 + #ifdef FEAT_DIFF
       
   106 + static int wininfo_other_tab_diff __ARGS((wininfo_T *wip));
       
   107 + 
       
   108 + /*
       
   109 +  * Return TRUE when "wip" has 'diff' set and the diff is only for another tab
       
   110 +  * page.  That's because a diff is local to a tab page.
       
   111 +  */
       
   112 +     static int
       
   113 + wininfo_other_tab_diff(wip)
       
   114 +     wininfo_T	*wip;
       
   115 + {
       
   116 +     win_T	*wp;
       
   117 + 
       
   118 +     if (wip->wi_opt.wo_diff)
       
   119 +     {
       
   120 + 	for (wp = firstwin; wp != NULL; wp = wp->w_next)
       
   121 + 	    /* return FALSE when it's a window in the current tab page, thus
       
   122 + 	     * the buffer was in diff mode here */
       
   123 + 	    if (wip->wi_win == wp)
       
   124 + 		return FALSE;
       
   125 + 	return TRUE;
       
   126 +     }
       
   127 +     return FALSE;
       
   128 + }
       
   129 + #endif
       
   130 + 
       
   131   /*
       
   132    * Find info for the current window in buffer "buf".
       
   133    * If not found, return the info for the most recently used window.
       
   134 +  * When "skip_diff_buffer" is TRUE avoid windows with 'diff' set that is in
       
   135 +  * another tab page.
       
   136    * Returns NULL when there isn't any info.
       
   137    */
       
   138 + /*ARGSUSED*/
       
   139       static wininfo_T *
       
   140 ! find_wininfo(buf, skip_diff_buffer)
       
   141       buf_T	*buf;
       
   142 +     int		skip_diff_buffer;
       
   143   {
       
   144       wininfo_T	*wip;
       
   145   
       
   146       for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next)
       
   147 ! 	if (wip->wi_win == curwin
       
   148 ! #ifdef FEAT_DIFF
       
   149 ! 		&& (!skip_diff_buffer || !wininfo_other_tab_diff(wip))
       
   150 ! #endif
       
   151 ! 	   )
       
   152   	    break;
       
   153 ! 
       
   154 !     /* If no wininfo for curwin, use the first in the list (that doesn't have
       
   155 !      * 'diff' set and is in another tab page). */
       
   156 !     if (wip == NULL)
       
   157 !     {
       
   158 ! #ifdef FEAT_DIFF
       
   159 ! 	if (skip_diff_buffer)
       
   160 ! 	{
       
   161 ! 	    for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next)
       
   162 ! 		if (!wininfo_other_tab_diff(wip))
       
   163 ! 		    break;
       
   164 ! 	}
       
   165 ! 	else
       
   166 ! #endif
       
   167 ! 	    wip = buf->b_wininfo;
       
   168 !     }
       
   169       return wip;
       
   170   }
       
   171   
       
   172 ***************
       
   173 *** 2440,2446 ****
       
   174       clearFolding(curwin);
       
   175   #endif
       
   176   
       
   177 !     wip = find_wininfo(buf);
       
   178       if (wip != NULL && wip->wi_optset)
       
   179       {
       
   180   	copy_winopt(&wip->wi_opt, &curwin->w_onebuf_opt);
       
   181 --- 2488,2494 ----
       
   182       clearFolding(curwin);
       
   183   #endif
       
   184   
       
   185 !     wip = find_wininfo(buf, TRUE);
       
   186       if (wip != NULL && wip->wi_optset)
       
   187       {
       
   188   	copy_winopt(&wip->wi_opt, &curwin->w_onebuf_opt);
       
   189 ***************
       
   190 *** 2472,2478 ****
       
   191       wininfo_T	*wip;
       
   192       static pos_T no_position = {1, 0};
       
   193   
       
   194 !     wip = find_wininfo(buf);
       
   195       if (wip != NULL)
       
   196   	return &(wip->wi_fpos);
       
   197       else
       
   198 --- 2520,2526 ----
       
   199       wininfo_T	*wip;
       
   200       static pos_T no_position = {1, 0};
       
   201   
       
   202 !     wip = find_wininfo(buf, FALSE);
       
   203       if (wip != NULL)
       
   204   	return &(wip->wi_fpos);
       
   205       else
       
   206 ***************
       
   207 *** 2793,2806 ****
       
   208   #endif
       
   209   
       
   210   /*
       
   211 !  * Set alternate cursor position for current window.
       
   212    * Also save the local window option values.
       
   213    */
       
   214       void
       
   215 ! buflist_altfpos()
       
   216   {
       
   217 !     buflist_setfpos(curbuf, curwin, curwin->w_cursor.lnum,
       
   218 ! 						  curwin->w_cursor.col, TRUE);
       
   219   }
       
   220   
       
   221   /*
       
   222 --- 2841,2854 ----
       
   223   #endif
       
   224   
       
   225   /*
       
   226 !  * Set alternate cursor position for the current buffer and window "win".
       
   227    * Also save the local window option values.
       
   228    */
       
   229       void
       
   230 ! buflist_altfpos(win)
       
   231 !     win_T *win;
       
   232   {
       
   233 !     buflist_setfpos(curbuf, win, win->w_cursor.lnum, win->w_cursor.col, TRUE);
       
   234   }
       
   235   
       
   236   /*
       
   237 ***************
       
   238 *** 4492,4498 ****
       
   239   		      ECMD_ONE,
       
   240   		      ((P_HID(curwin->w_buffer)
       
   241   			   || bufIsChanged(curwin->w_buffer)) ? ECMD_HIDE : 0)
       
   242 ! 							       + ECMD_OLDBUF);
       
   243   #ifdef FEAT_AUTOCMD
       
   244   	    if (use_firstwin)
       
   245   		++autocmd_no_leave;
       
   246 --- 4540,4546 ----
       
   247   		      ECMD_ONE,
       
   248   		      ((P_HID(curwin->w_buffer)
       
   249   			   || bufIsChanged(curwin->w_buffer)) ? ECMD_HIDE : 0)
       
   250 ! 						       + ECMD_OLDBUF, curwin);
       
   251   #ifdef FEAT_AUTOCMD
       
   252   	    if (use_firstwin)
       
   253   		++autocmd_no_leave;
       
   254 *** ../vim-7.2.040/src/ex_cmds.c	Sun Nov  9 13:43:25 2008
       
   255 --- src/ex_cmds.c	Wed Nov 12 22:41:41 2008
       
   256 ***************
       
   257 *** 3052,3058 ****
       
   258   	retval = 0;	/* it's in the same file */
       
   259       }
       
   260       else if (do_ecmd(fnum, ffname, sfname, NULL, lnum,
       
   261 ! 		(P_HID(curbuf) ? ECMD_HIDE : 0) + (forceit ? ECMD_FORCEIT : 0)) == OK)
       
   262   	retval = -1;	/* opened another file */
       
   263       else
       
   264   	retval = 1;	/* error encountered */
       
   265 --- 3052,3059 ----
       
   266   	retval = 0;	/* it's in the same file */
       
   267       }
       
   268       else if (do_ecmd(fnum, ffname, sfname, NULL, lnum,
       
   269 ! 		(P_HID(curbuf) ? ECMD_HIDE : 0) + (forceit ? ECMD_FORCEIT : 0),
       
   270 ! 		curwin) == OK)
       
   271   	retval = -1;	/* opened another file */
       
   272       else
       
   273   	retval = 1;	/* error encountered */
       
   274 ***************
       
   275 *** 3085,3101 ****
       
   276    *	 ECMD_OLDBUF: use existing buffer if it exists
       
   277    *	ECMD_FORCEIT: ! used for Ex command
       
   278    *	 ECMD_ADDBUF: don't edit, just add to buffer list
       
   279    *
       
   280    * return FAIL for failure, OK otherwise
       
   281    */
       
   282       int
       
   283 ! do_ecmd(fnum, ffname, sfname, eap, newlnum, flags)
       
   284       int		fnum;
       
   285       char_u	*ffname;
       
   286       char_u	*sfname;
       
   287       exarg_T	*eap;			/* can be NULL! */
       
   288       linenr_T	newlnum;
       
   289       int		flags;
       
   290   {
       
   291       int		other_file;		/* TRUE if editing another file */
       
   292       int		oldbuf;			/* TRUE if using existing buffer */
       
   293 --- 3086,3106 ----
       
   294    *	 ECMD_OLDBUF: use existing buffer if it exists
       
   295    *	ECMD_FORCEIT: ! used for Ex command
       
   296    *	 ECMD_ADDBUF: don't edit, just add to buffer list
       
   297 +  *   oldwin: Should be "curwin" when editing a new buffer in the current
       
   298 +  *           window, NULL when splitting the window first.  When not NULL info
       
   299 +  *           of the previous buffer for "oldwin" is stored.
       
   300    *
       
   301    * return FAIL for failure, OK otherwise
       
   302    */
       
   303       int
       
   304 ! do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
       
   305       int		fnum;
       
   306       char_u	*ffname;
       
   307       char_u	*sfname;
       
   308       exarg_T	*eap;			/* can be NULL! */
       
   309       linenr_T	newlnum;
       
   310       int		flags;
       
   311 +     win_T	*oldwin;
       
   312   {
       
   313       int		other_file;		/* TRUE if editing another file */
       
   314       int		oldbuf;			/* TRUE if using existing buffer */
       
   315 ***************
       
   316 *** 3267,3273 ****
       
   317   	{
       
   318   	    if (!cmdmod.keepalt)
       
   319   		curwin->w_alt_fnum = curbuf->b_fnum;
       
   320 ! 	    buflist_altfpos();
       
   321   	}
       
   322   
       
   323   	if (fnum)
       
   324 --- 3272,3279 ----
       
   325   	{
       
   326   	    if (!cmdmod.keepalt)
       
   327   		curwin->w_alt_fnum = curbuf->b_fnum;
       
   328 ! 	    if (oldwin != NULL)
       
   329 ! 		buflist_altfpos(oldwin);
       
   330   	}
       
   331   
       
   332   	if (fnum)
       
   333 ***************
       
   334 *** 3371,3377 ****
       
   335   
       
   336   		/* close the link to the current buffer */
       
   337   		u_sync(FALSE);
       
   338 ! 		close_buffer(curwin, curbuf,
       
   339   				      (flags & ECMD_HIDE) ? 0 : DOBUF_UNLOAD);
       
   340   
       
   341   #ifdef FEAT_AUTOCMD
       
   342 --- 3377,3383 ----
       
   343   
       
   344   		/* close the link to the current buffer */
       
   345   		u_sync(FALSE);
       
   346 ! 		close_buffer(oldwin, curbuf,
       
   347   				      (flags & ECMD_HIDE) ? 0 : DOBUF_UNLOAD);
       
   348   
       
   349   #ifdef FEAT_AUTOCMD
       
   350 ***************
       
   351 *** 5609,5615 ****
       
   352   	     */
       
   353   	    alt_fnum = curbuf->b_fnum;
       
   354   	    (void)do_ecmd(0, NULL, NULL, NULL, ECMD_LASTL,
       
   355 ! 						   ECMD_HIDE + ECMD_SET_HELP);
       
   356   	    if (!cmdmod.keepalt)
       
   357   		curwin->w_alt_fnum = alt_fnum;
       
   358   	    empty_fnum = curbuf->b_fnum;
       
   359 --- 5615,5627 ----
       
   360   	     */
       
   361   	    alt_fnum = curbuf->b_fnum;
       
   362   	    (void)do_ecmd(0, NULL, NULL, NULL, ECMD_LASTL,
       
   363 ! 			  ECMD_HIDE + ECMD_SET_HELP,
       
   364 ! #ifdef FEAT_WINDOWS
       
   365 ! 			  NULL  /* buffer is still open, don't store info */
       
   366 ! #else
       
   367 ! 			  curwin
       
   368 ! #endif
       
   369 ! 		    );
       
   370   	    if (!cmdmod.keepalt)
       
   371   		curwin->w_alt_fnum = alt_fnum;
       
   372   	    empty_fnum = curbuf->b_fnum;
       
   373 *** ../vim-7.2.040/src/ex_cmds2.c	Sun Sep  7 15:49:45 2008
       
   374 --- src/ex_cmds2.c	Wed Nov 12 17:46:41 2008
       
   375 ***************
       
   376 *** 2132,2139 ****
       
   377   	 * argument index. */
       
   378   	if (do_ecmd(0, alist_name(&ARGLIST[curwin->w_arg_idx]), NULL,
       
   379   		      eap, ECMD_LAST,
       
   380 ! 		      (P_HID(curwin->w_buffer) ? ECMD_HIDE : 0) +
       
   381 ! 				   (eap->forceit ? ECMD_FORCEIT : 0)) == FAIL)
       
   382   	    curwin->w_arg_idx = old_arg_idx;
       
   383   	/* like Vi: set the mark where the cursor is in the file. */
       
   384   	else if (eap->cmdidx != CMD_argdo)
       
   385 --- 2132,2139 ----
       
   386   	 * argument index. */
       
   387   	if (do_ecmd(0, alist_name(&ARGLIST[curwin->w_arg_idx]), NULL,
       
   388   		      eap, ECMD_LAST,
       
   389 ! 		      (P_HID(curwin->w_buffer) ? ECMD_HIDE : 0)
       
   390 ! 			 + (eap->forceit ? ECMD_FORCEIT : 0), curwin) == FAIL)
       
   391   	    curwin->w_arg_idx = old_arg_idx;
       
   392   	/* like Vi: set the mark where the cursor is in the file. */
       
   393   	else if (eap->cmdidx != CMD_argdo)
       
   394 *** ../vim-7.2.040/src/ex_docmd.c	Sun Nov  9 13:43:25 2008
       
   395 --- src/ex_docmd.c	Wed Nov 12 18:04:22 2008
       
   396 ***************
       
   397 *** 7488,7494 ****
       
   398   	/* ":new" or ":tabnew" without argument: edit an new empty buffer */
       
   399   	setpcmark();
       
   400   	(void)do_ecmd(0, NULL, NULL, eap, ECMD_ONE,
       
   401 ! 			       ECMD_HIDE + (eap->forceit ? ECMD_FORCEIT : 0));
       
   402       }
       
   403       else if ((eap->cmdidx != CMD_split
       
   404   #ifdef FEAT_VERTSPLIT
       
   405 --- 7488,7495 ----
       
   406   	/* ":new" or ":tabnew" without argument: edit an new empty buffer */
       
   407   	setpcmark();
       
   408   	(void)do_ecmd(0, NULL, NULL, eap, ECMD_ONE,
       
   409 ! 		      ECMD_HIDE + (eap->forceit ? ECMD_FORCEIT : 0),
       
   410 ! 		      old_curwin == NULL ? curwin : NULL);
       
   411       }
       
   412       else if ((eap->cmdidx != CMD_split
       
   413   #ifdef FEAT_VERTSPLIT
       
   414 ***************
       
   415 *** 7525,7531 ****
       
   416   #ifdef FEAT_LISTCMDS
       
   417   		    + (eap->cmdidx == CMD_badd ? ECMD_ADDBUF : 0 )
       
   418   #endif
       
   419 ! 		    ) == FAIL)
       
   420   	{
       
   421   	    /* Editing the file failed.  If the window was split, close it. */
       
   422   #ifdef FEAT_WINDOWS
       
   423 --- 7526,7532 ----
       
   424   #ifdef FEAT_LISTCMDS
       
   425   		    + (eap->cmdidx == CMD_badd ? ECMD_ADDBUF : 0 )
       
   426   #endif
       
   427 ! 		    , old_curwin == NULL ? curwin : NULL) == FAIL)
       
   428   	{
       
   429   	    /* Editing the file failed.  If the window was split, close it. */
       
   430   #ifdef FEAT_WINDOWS
       
   431 *** ../vim-7.2.040/src/ex_getln.c	Sun Sep 14 14:41:44 2008
       
   432 --- src/ex_getln.c	Wed Nov 12 18:06:25 2008
       
   433 ***************
       
   434 *** 6051,6057 ****
       
   435   	cmdwin_type = '-';
       
   436   
       
   437       /* Create the command-line buffer empty. */
       
   438 !     (void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE);
       
   439       (void)setfname(curbuf, (char_u *)"[Command Line]", NULL, TRUE);
       
   440       set_option_value((char_u *)"bt", 0L, (char_u *)"nofile", OPT_LOCAL);
       
   441       set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
       
   442 --- 6051,6057 ----
       
   443   	cmdwin_type = '-';
       
   444   
       
   445       /* Create the command-line buffer empty. */
       
   446 !     (void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, NULL);
       
   447       (void)setfname(curbuf, (char_u *)"[Command Line]", NULL, TRUE);
       
   448       set_option_value((char_u *)"bt", 0L, (char_u *)"nofile", OPT_LOCAL);
       
   449       set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
       
   450 *** ../vim-7.2.040/src/main.c	Sun Nov  9 13:43:25 2008
       
   451 --- src/main.c	Wed Nov 12 17:49:06 2008
       
   452 ***************
       
   453 *** 2588,2594 ****
       
   454   # endif
       
   455   	    (void)do_ecmd(0, arg_idx < GARGCOUNT
       
   456   			  ? alist_name(&GARGLIST[arg_idx]) : NULL,
       
   457 ! 			  NULL, NULL, ECMD_LASTL, ECMD_HIDE);
       
   458   # ifdef HAS_SWAP_EXISTS_ACTION
       
   459   	    if (swap_exists_did_quit)
       
   460   	    {
       
   461 --- 2588,2594 ----
       
   462   # endif
       
   463   	    (void)do_ecmd(0, arg_idx < GARGCOUNT
       
   464   			  ? alist_name(&GARGLIST[arg_idx]) : NULL,
       
   465 ! 			  NULL, NULL, ECMD_LASTL, ECMD_HIDE, curwin);
       
   466   # ifdef HAS_SWAP_EXISTS_ACTION
       
   467   	    if (swap_exists_did_quit)
       
   468   	    {
       
   469 *** ../vim-7.2.040/src/netbeans.c	Sun Jul 13 19:18:03 2008
       
   470 --- src/netbeans.c	Wed Nov 12 17:49:40 2008
       
   471 ***************
       
   472 *** 1795,1801 ****
       
   473   	    buf->displayname = NULL;
       
   474   
       
   475   	    netbeansReadFile = 0; /* don't try to open disk file */
       
   476 ! 	    do_ecmd(0, NULL, 0, 0, ECMD_ONE, ECMD_HIDE + ECMD_OLDBUF);
       
   477   	    netbeansReadFile = 1;
       
   478   	    buf->bufp = curbuf;
       
   479   	    maketitle();
       
   480 --- 1795,1801 ----
       
   481   	    buf->displayname = NULL;
       
   482   
       
   483   	    netbeansReadFile = 0; /* don't try to open disk file */
       
   484 ! 	    do_ecmd(0, NULL, 0, 0, ECMD_ONE, ECMD_HIDE + ECMD_OLDBUF, curwin);
       
   485   	    netbeansReadFile = 1;
       
   486   	    buf->bufp = curbuf;
       
   487   	    maketitle();
       
   488 ***************
       
   489 *** 1960,1966 ****
       
   490   
       
   491   	    netbeansReadFile = 0; /* don't try to open disk file */
       
   492   	    do_ecmd(0, (char_u *)buf->displayname, 0, 0, ECMD_ONE,
       
   493 ! 						     ECMD_HIDE + ECMD_OLDBUF);
       
   494   	    netbeansReadFile = 1;
       
   495   	    buf->bufp = curbuf;
       
   496   	    maketitle();
       
   497 --- 1960,1966 ----
       
   498   
       
   499   	    netbeansReadFile = 0; /* don't try to open disk file */
       
   500   	    do_ecmd(0, (char_u *)buf->displayname, 0, 0, ECMD_ONE,
       
   501 ! 					     ECMD_HIDE + ECMD_OLDBUF, curwin);
       
   502   	    netbeansReadFile = 1;
       
   503   	    buf->bufp = curbuf;
       
   504   	    maketitle();
       
   505 ***************
       
   506 *** 1979,1985 ****
       
   507   	    vim_free(buf->displayname);
       
   508   	    buf->displayname = nb_unquote(args, NULL);
       
   509   	    do_ecmd(0, (char_u *)buf->displayname, NULL, NULL, ECMD_ONE,
       
   510 ! 						     ECMD_HIDE + ECMD_OLDBUF);
       
   511   	    buf->bufp = curbuf;
       
   512   	    buf->initDone = TRUE;
       
   513   	    doupdate = 1;
       
   514 --- 1979,1985 ----
       
   515   	    vim_free(buf->displayname);
       
   516   	    buf->displayname = nb_unquote(args, NULL);
       
   517   	    do_ecmd(0, (char_u *)buf->displayname, NULL, NULL, ECMD_ONE,
       
   518 ! 					     ECMD_HIDE + ECMD_OLDBUF, curwin);
       
   519   	    buf->bufp = curbuf;
       
   520   	    buf->initDone = TRUE;
       
   521   	    doupdate = 1;
       
   522 *** ../vim-7.2.040/src/normal.c	Sat Nov  1 13:51:57 2008
       
   523 --- src/normal.c	Wed Nov 12 17:49:50 2008
       
   524 ***************
       
   525 *** 6050,6056 ****
       
   526   	    autowrite(curbuf, FALSE);
       
   527   	setpcmark();
       
   528   	(void)do_ecmd(0, ptr, NULL, NULL, ECMD_LAST,
       
   529 ! 					       P_HID(curbuf) ? ECMD_HIDE : 0);
       
   530   	if (cap->nchar == 'F' && lnum >= 0)
       
   531   	{
       
   532   	    curwin->w_cursor.lnum = lnum;
       
   533 --- 6050,6056 ----
       
   534   	    autowrite(curbuf, FALSE);
       
   535   	setpcmark();
       
   536   	(void)do_ecmd(0, ptr, NULL, NULL, ECMD_LAST,
       
   537 ! 				       P_HID(curbuf) ? ECMD_HIDE : 0, curwin);
       
   538   	if (cap->nchar == 'F' && lnum >= 0)
       
   539   	{
       
   540   	    curwin->w_cursor.lnum = lnum;
       
   541 *** ../vim-7.2.040/src/popupmnu.c	Sun Jul 13 19:33:51 2008
       
   542 --- src/popupmnu.c	Wed Nov 12 18:08:07 2008
       
   543 ***************
       
   544 *** 573,579 ****
       
   545   		{
       
   546   		    /* Don't want to sync undo in the current buffer. */
       
   547   		    ++no_u_sync;
       
   548 ! 		    res = do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, 0);
       
   549   		    --no_u_sync;
       
   550   		    if (res == OK)
       
   551   		    {
       
   552 --- 573,579 ----
       
   553   		{
       
   554   		    /* Don't want to sync undo in the current buffer. */
       
   555   		    ++no_u_sync;
       
   556 ! 		    res = do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, 0, NULL);
       
   557   		    --no_u_sync;
       
   558   		    if (res == OK)
       
   559   		    {
       
   560 *** ../vim-7.2.040/src/proto/buffer.pro	Sun May  6 13:57:53 2007
       
   561 --- src/proto/buffer.pro	Wed Nov 12 17:43:39 2008
       
   562 ***************
       
   563 *** 33,39 ****
       
   564   char_u *getaltfname __ARGS((int errmsg));
       
   565   int buflist_add __ARGS((char_u *fname, int flags));
       
   566   void buflist_slash_adjust __ARGS((void));
       
   567 ! void buflist_altfpos __ARGS((void));
       
   568   int otherfile __ARGS((char_u *ffname));
       
   569   void buf_setino __ARGS((buf_T *buf));
       
   570   void fileinfo __ARGS((int fullname, int shorthelp, int dont_truncate));
       
   571 --- 33,39 ----
       
   572   char_u *getaltfname __ARGS((int errmsg));
       
   573   int buflist_add __ARGS((char_u *fname, int flags));
       
   574   void buflist_slash_adjust __ARGS((void));
       
   575 ! void buflist_altfpos __ARGS((win_T *win));
       
   576   int otherfile __ARGS((char_u *ffname));
       
   577   void buf_setino __ARGS((buf_T *buf));
       
   578   void fileinfo __ARGS((int fullname, int shorthelp, int dont_truncate));
       
   579 *** ../vim-7.2.040/src/proto/ex_cmds.pro	Sun Nov  9 13:43:25 2008
       
   580 --- src/proto/ex_cmds.pro	Wed Nov 12 17:44:27 2008
       
   581 ***************
       
   582 *** 27,33 ****
       
   583   void do_wqall __ARGS((exarg_T *eap));
       
   584   int not_writing __ARGS((void));
       
   585   int getfile __ARGS((int fnum, char_u *ffname, char_u *sfname, int setpm, linenr_T lnum, int forceit));
       
   586 ! int do_ecmd __ARGS((int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T newlnum, int flags));
       
   587   void ex_append __ARGS((exarg_T *eap));
       
   588   void ex_change __ARGS((exarg_T *eap));
       
   589   void ex_z __ARGS((exarg_T *eap));
       
   590 --- 27,33 ----
       
   591   void do_wqall __ARGS((exarg_T *eap));
       
   592   int not_writing __ARGS((void));
       
   593   int getfile __ARGS((int fnum, char_u *ffname, char_u *sfname, int setpm, linenr_T lnum, int forceit));
       
   594 ! int do_ecmd __ARGS((int fnum, char_u *ffname, char_u *sfname, exarg_T *eap, linenr_T newlnum, int flags, win_T *oldwin));
       
   595   void ex_append __ARGS((exarg_T *eap));
       
   596   void ex_change __ARGS((exarg_T *eap));
       
   597   void ex_z __ARGS((exarg_T *eap));
       
   598 *** ../vim-7.2.040/src/quickfix.c	Thu Jul 24 18:44:59 2008
       
   599 --- src/quickfix.c	Wed Nov 12 18:12:00 2008
       
   600 ***************
       
   601 *** 1420,1425 ****
       
   602 --- 1420,1426 ----
       
   603       win_T		*win;
       
   604       win_T		*altwin;
       
   605   #endif
       
   606 +     win_T		*oldwin = curwin;
       
   607       int			print_message = TRUE;
       
   608       int			len;
       
   609   #ifdef FEAT_FOLDING
       
   610 ***************
       
   611 *** 1744,1750 ****
       
   612   	    }
       
   613   	    else
       
   614   		ok = do_ecmd(qf_ptr->qf_fnum, NULL, NULL, NULL, (linenr_T)1,
       
   615 ! 						   ECMD_HIDE + ECMD_SET_HELP);
       
   616   	}
       
   617   	else
       
   618   	    ok = buflist_getfile(qf_ptr->qf_fnum,
       
   619 --- 1745,1752 ----
       
   620   	    }
       
   621   	    else
       
   622   		ok = do_ecmd(qf_ptr->qf_fnum, NULL, NULL, NULL, (linenr_T)1,
       
   623 ! 					   ECMD_HIDE + ECMD_SET_HELP,
       
   624 ! 					   oldwin == curwin ? curwin : NULL);
       
   625   	}
       
   626   	else
       
   627   	    ok = buflist_getfile(qf_ptr->qf_fnum,
       
   628 ***************
       
   629 *** 2267,2272 ****
       
   630 --- 2269,2275 ----
       
   631       win_T	*win;
       
   632       tabpage_T	*prevtab = curtab;
       
   633       buf_T	*qf_buf;
       
   634 +     win_T	*oldwin = curwin;
       
   635   
       
   636       if (eap->cmdidx == CMD_lopen || eap->cmdidx == CMD_lwindow)
       
   637       {
       
   638 ***************
       
   639 *** 2326,2339 ****
       
   640   	    win->w_llist->qf_refcount++;
       
   641   	}
       
   642   
       
   643   	if (qf_buf != NULL)
       
   644   	    /* Use the existing quickfix buffer */
       
   645   	    (void)do_ecmd(qf_buf->b_fnum, NULL, NULL, NULL, ECMD_ONE,
       
   646 ! 						     ECMD_HIDE + ECMD_OLDBUF);
       
   647   	else
       
   648   	{
       
   649   	    /* Create a new quickfix buffer */
       
   650 ! 	    (void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE);
       
   651   	    /* switch off 'swapfile' */
       
   652   	    set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
       
   653   	    set_option_value((char_u *)"bt", 0L, (char_u *)"quickfix",
       
   654 --- 2329,2344 ----
       
   655   	    win->w_llist->qf_refcount++;
       
   656   	}
       
   657   
       
   658 + 	if (oldwin != curwin)
       
   659 + 	    oldwin = NULL;  /* don't store info when in another window */
       
   660   	if (qf_buf != NULL)
       
   661   	    /* Use the existing quickfix buffer */
       
   662   	    (void)do_ecmd(qf_buf->b_fnum, NULL, NULL, NULL, ECMD_ONE,
       
   663 ! 					     ECMD_HIDE + ECMD_OLDBUF, oldwin);
       
   664   	else
       
   665   	{
       
   666   	    /* Create a new quickfix buffer */
       
   667 ! 	    (void)do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, oldwin);
       
   668   	    /* switch off 'swapfile' */
       
   669   	    set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
       
   670   	    set_option_value((char_u *)"bt", 0L, (char_u *)"quickfix",
       
   671 *** ../vim-7.2.040/src/window.c	Wed Aug  6 18:32:11 2008
       
   672 --- src/window.c	Wed Nov 12 18:12:37 2008
       
   673 ***************
       
   674 *** 531,537 ****
       
   675   # ifdef FEAT_SCROLLBIND
       
   676   			curwin->w_p_scb = FALSE;
       
   677   # endif
       
   678 ! 			(void)do_ecmd(0, ptr, NULL, NULL, ECMD_LASTL, ECMD_HIDE);
       
   679   			if (nchar == 'F' && lnum >= 0)
       
   680   			{
       
   681   			    curwin->w_cursor.lnum = lnum;
       
   682 --- 531,538 ----
       
   683   # ifdef FEAT_SCROLLBIND
       
   684   			curwin->w_p_scb = FALSE;
       
   685   # endif
       
   686 ! 			(void)do_ecmd(0, ptr, NULL, NULL, ECMD_LASTL,
       
   687 ! 							   ECMD_HIDE, NULL);
       
   688   			if (nchar == 'F' && lnum >= 0)
       
   689   			{
       
   690   			    curwin->w_cursor.lnum = lnum;
       
   691 *** ../vim-7.2.040/src/version.c	Wed Nov 12 16:04:43 2008
       
   692 --- src/version.c	Wed Nov 12 16:54:35 2008
       
   693 ***************
       
   694 *** 678,679 ****
       
   695 --- 678,681 ----
       
   696   {   /* Add new patch number below this line */
       
   697 + /**/
       
   698 +     41,
       
   699   /**/
       
   700 
       
   701 -- 
       
   702 hundred-and-one symptoms of being an internet addict:
       
   703 260. Co-workers have to E-mail you about the fire alarm to get
       
   704      you out of the building.
       
   705 
       
   706  /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
       
   707 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
       
   708 \\\        download, build and distribute -- http://www.A-A-P.org        ///
       
   709  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///