home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.2 / 7.2.041 < prev    next >
Encoding:
Internet Message Format  |  2008-11-14  |  22.5 KB

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