| To: vim-dev@vim.org |
| Subject: Patch 7.0.162 |
| Fcc: outbox |
| From: Bram Moolenaar <Bram@moolenaar.net> |
| Mime-Version: 1.0 |
| Content-Type: text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding: 8bit |
| |
| |
| Patch 7.0.162 |
| Problem: "vim -o a b" when file "a" triggers the ATTENTION dialog, |
| selecting "Quit" exits Vim instead of editing "b" only. |
| When file "b" triggers the ATTENTION dialog selecting "Quit" or |
| "Abort" results in editing file "a" in that window. |
| Solution: When selecting "Abort" exit Vim. When selecting "Quit" close the |
| window. Also avoid hit-enter prompt when selecting Abort. |
| Files: src/buffer.c, src/main.c |
| |
| |
| |
| |
| |
| *** 4220,4226 **** |
| |
| /* Use the name from the associated buffer if it exists. */ |
| bp = buflist_findnr(aep->ae_fnum); |
| ! if (bp == NULL) |
| return aep->ae_fname; |
| return bp->b_fname; |
| } |
| --- 4222,4228 ---- |
| |
| /* Use the name from the associated buffer if it exists. */ |
| bp = buflist_findnr(aep->ae_fnum); |
| ! if (bp == NULL || bp->b_fname == NULL) |
| return aep->ae_fname; |
| return bp->b_fname; |
| } |
| |
| |
| |
| *** 2392,2398 **** |
| (void)open_buffer(FALSE, NULL); /* create memfile, read file */ |
| |
| #if defined(HAS_SWAP_EXISTS_ACTION) |
| ! check_swap_exists_action(); |
| #endif |
| #ifdef FEAT_AUTOCMD |
| dorewind = TRUE; /* start again */ |
| --- 2392,2414 ---- |
| (void)open_buffer(FALSE, NULL); /* create memfile, read file */ |
| |
| #if defined(HAS_SWAP_EXISTS_ACTION) |
| ! if (swap_exists_action == SEA_QUIT) |
| ! { |
| ! if (got_int || only_one_window()) |
| ! { |
| ! /* abort selected or quit and only one window */ |
| ! did_emsg = FALSE; /* avoid hit-enter prompt */ |
| ! getout(1); |
| ! } |
| ! /* We can't close the window, it would disturb what |
| ! * happens next. Clear the file name and set the arg |
| ! * index to -1 to delete it later. */ |
| ! setfname(curbuf, NULL, NULL, FALSE); |
| ! curwin->w_arg_idx = -1; |
| ! swap_exists_action = SEA_NONE; |
| ! } |
| ! else |
| ! handle_swap_exists(NULL); |
| #endif |
| #ifdef FEAT_AUTOCMD |
| dorewind = TRUE; /* start again */ |
| |
| *** 2432,2437 **** |
| --- 2448,2455 ---- |
| { |
| int arg_idx; /* index in argument list */ |
| int i; |
| + int advance = TRUE; |
| + buf_T *old_curbuf; |
| |
| # ifdef FEAT_AUTOCMD |
| /* |
| |
| *** 2440,2470 **** |
| ++autocmd_no_enter; |
| ++autocmd_no_leave; |
| # endif |
| arg_idx = 1; |
| for (i = 1; i < parmp->window_count; ++i) |
| { |
| ! if (parmp->window_layout == WIN_TABS) |
| { |
| ! if (curtab->tp_next == NULL) /* just checking */ |
| ! break; |
| ! goto_tabpage(0); |
| } |
| ! else |
| { |
| ! if (curwin->w_next == NULL) /* just checking */ |
| ! break; |
| ! win_enter(curwin->w_next, FALSE); |
| } |
| |
| /* Only open the file if there is no file in this window yet (that can |
| ! * happen when .vimrc contains ":sall") */ |
| if (curbuf == firstwin->w_buffer || curbuf->b_ffname == NULL) |
| { |
| curwin->w_arg_idx = arg_idx; |
| ! /* edit file from arg list, if there is one */ |
| (void)do_ecmd(0, arg_idx < GARGCOUNT |
| ? alist_name(&GARGLIST[arg_idx]) : NULL, |
| NULL, NULL, ECMD_LASTL, ECMD_HIDE); |
| if (arg_idx == GARGCOUNT - 1) |
| arg_had_last = TRUE; |
| ++arg_idx; |
| --- 2458,2522 ---- |
| ++autocmd_no_enter; |
| ++autocmd_no_leave; |
| # endif |
| + |
| + /* When w_arg_idx is -1 remove the window (see create_windows()). */ |
| + if (curwin->w_arg_idx == -1) |
| + { |
| + win_close(curwin, TRUE); |
| + advance = FALSE; |
| + } |
| + |
| arg_idx = 1; |
| for (i = 1; i < parmp->window_count; ++i) |
| { |
| ! /* When w_arg_idx is -1 remove the window (see create_windows()). */ |
| ! if (curwin->w_arg_idx == -1) |
| { |
| ! ++arg_idx; |
| ! win_close(curwin, TRUE); |
| ! advance = FALSE; |
| ! continue; |
| } |
| ! |
| ! if (advance) |
| { |
| ! if (parmp->window_layout == WIN_TABS) |
| ! { |
| ! if (curtab->tp_next == NULL) /* just checking */ |
| ! break; |
| ! goto_tabpage(0); |
| ! } |
| ! else |
| ! { |
| ! if (curwin->w_next == NULL) /* just checking */ |
| ! break; |
| ! win_enter(curwin->w_next, FALSE); |
| ! } |
| } |
| + advance = TRUE; |
| |
| /* Only open the file if there is no file in this window yet (that can |
| ! * happen when .vimrc contains ":sall"). */ |
| if (curbuf == firstwin->w_buffer || curbuf->b_ffname == NULL) |
| { |
| curwin->w_arg_idx = arg_idx; |
| ! /* Edit file from arg list, if there is one. When "Quit" selected |
| ! * at the ATTENTION prompt close the window. */ |
| ! old_curbuf = curbuf; |
| (void)do_ecmd(0, arg_idx < GARGCOUNT |
| ? alist_name(&GARGLIST[arg_idx]) : NULL, |
| NULL, NULL, ECMD_LASTL, ECMD_HIDE); |
| + if (curbuf == old_curbuf) |
| + { |
| + if (got_int || only_one_window()) |
| + { |
| + /* abort selected or quit and only one window */ |
| + did_emsg = FALSE; /* avoid hit-enter prompt */ |
| + getout(1); |
| + } |
| + win_close(curwin, TRUE); |
| + advance = FALSE; |
| + } |
| if (arg_idx == GARGCOUNT - 1) |
| arg_had_last = TRUE; |
| ++arg_idx; |
| |
| |
| |
| *** 668,669 **** |
| --- 668,671 ---- |
| { /* Add new patch number below this line */ |
| + /**/ |
| + 162, |
| /**/ |
| |
| -- |
| The CIA drives around in cars with the "Intel inside" logo. |
| |
| /// Bram Moolenaar -- Bram@Moolenaar.net -- 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 /// |