|
|
22c937 |
To: vim_dev@googlegroups.com
|
|
|
22c937 |
Subject: Patch 7.4.082
|
|
|
22c937 |
Fcc: outbox
|
|
|
22c937 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
|
22c937 |
Mime-Version: 1.0
|
|
|
22c937 |
Content-Type: text/plain; charset=UTF-8
|
|
|
22c937 |
Content-Transfer-Encoding: 8bit
|
|
|
22c937 |
------------
|
|
|
22c937 |
|
|
|
22c937 |
Patch 7.4.082
|
|
|
22c937 |
Problem: Using "gf" in a changed buffer suggests adding "!", which is not
|
|
|
22c937 |
possible. (Tim Chase)
|
|
|
22c937 |
Solution: Pass a flag to check_changed() wether adding ! make sense.
|
|
|
22c937 |
Files: src/vim.h, src/ex_cmds2.c, src/proto/ex_cmds2.pro, src/globals.h,
|
|
|
22c937 |
src/ex_cmds.c, src/ex_docmd.c
|
|
|
22c937 |
|
|
|
22c937 |
|
|
|
22c937 |
*** ../vim-7.4.081/src/vim.h 2013-11-08 04:30:06.000000000 +0100
|
|
|
22c937 |
--- src/vim.h 2013-11-09 03:00:00.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 1176,1181 ****
|
|
|
22c937 |
--- 1176,1190 ----
|
|
|
22c937 |
#define RESIZE_BOTH 15 /* resize in both directions */
|
|
|
22c937 |
|
|
|
22c937 |
/*
|
|
|
22c937 |
+ * flags for check_changed()
|
|
|
22c937 |
+ */
|
|
|
22c937 |
+ #define CCGD_AW 1 /* do autowrite if buffer was changed */
|
|
|
22c937 |
+ #define CCGD_MULTWIN 2 /* check also when several wins for the buf */
|
|
|
22c937 |
+ #define CCGD_FORCEIT 4 /* ! used */
|
|
|
22c937 |
+ #define CCGD_ALLBUF 8 /* may write all buffers */
|
|
|
22c937 |
+ #define CCGD_EXCMD 16 /* may suggest using ! */
|
|
|
22c937 |
+
|
|
|
22c937 |
+ /*
|
|
|
22c937 |
* "flags" values for option-setting functions.
|
|
|
22c937 |
* When OPT_GLOBAL and OPT_LOCAL are both missing, set both local and global
|
|
|
22c937 |
* values, get local value.
|
|
|
22c937 |
*** ../vim-7.4.081/src/ex_cmds2.c 2013-06-28 20:14:53.000000000 +0200
|
|
|
22c937 |
--- src/ex_cmds2.c 2013-11-09 03:14:44.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 1436,1455 ****
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
/*
|
|
|
22c937 |
! * return TRUE if buffer was changed and cannot be abandoned.
|
|
|
22c937 |
*/
|
|
|
22c937 |
int
|
|
|
22c937 |
! check_changed(buf, checkaw, mult_win, forceit, allbuf)
|
|
|
22c937 |
buf_T *buf;
|
|
|
22c937 |
! int checkaw; /* do autowrite if buffer was changed */
|
|
|
22c937 |
! int mult_win; /* check also when several wins for the buf */
|
|
|
22c937 |
! int forceit;
|
|
|
22c937 |
! int allbuf UNUSED; /* may write all buffers */
|
|
|
22c937 |
{
|
|
|
22c937 |
if ( !forceit
|
|
|
22c937 |
&& bufIsChanged(buf)
|
|
|
22c937 |
! && (mult_win || buf->b_nwindows <= 1)
|
|
|
22c937 |
! && (!checkaw || autowrite(buf, forceit) == FAIL))
|
|
|
22c937 |
{
|
|
|
22c937 |
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
|
|
|
22c937 |
if ((p_confirm || cmdmod.confirm) && p_write)
|
|
|
22c937 |
--- 1436,1455 ----
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
/*
|
|
|
22c937 |
! * Return TRUE if buffer was changed and cannot be abandoned.
|
|
|
22c937 |
! * For flags use the CCGD_ values.
|
|
|
22c937 |
*/
|
|
|
22c937 |
int
|
|
|
22c937 |
! check_changed(buf, flags)
|
|
|
22c937 |
buf_T *buf;
|
|
|
22c937 |
! int flags;
|
|
|
22c937 |
{
|
|
|
22c937 |
+ int forceit = (flags & CCGD_FORCEIT);
|
|
|
22c937 |
+
|
|
|
22c937 |
if ( !forceit
|
|
|
22c937 |
&& bufIsChanged(buf)
|
|
|
22c937 |
! && ((flags & CCGD_MULTWIN) || buf->b_nwindows <= 1)
|
|
|
22c937 |
! && (!(flags & CCGD_AW) || autowrite(buf, forceit) == FAIL))
|
|
|
22c937 |
{
|
|
|
22c937 |
#if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
|
|
|
22c937 |
if ((p_confirm || cmdmod.confirm) && p_write)
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 1457,1463 ****
|
|
|
22c937 |
buf_T *buf2;
|
|
|
22c937 |
int count = 0;
|
|
|
22c937 |
|
|
|
22c937 |
! if (allbuf)
|
|
|
22c937 |
for (buf2 = firstbuf; buf2 != NULL; buf2 = buf2->b_next)
|
|
|
22c937 |
if (bufIsChanged(buf2)
|
|
|
22c937 |
&& (buf2->b_ffname != NULL
|
|
|
22c937 |
--- 1457,1463 ----
|
|
|
22c937 |
buf_T *buf2;
|
|
|
22c937 |
int count = 0;
|
|
|
22c937 |
|
|
|
22c937 |
! if (flags & CCGD_ALLBUF)
|
|
|
22c937 |
for (buf2 = firstbuf; buf2 != NULL; buf2 = buf2->b_next)
|
|
|
22c937 |
if (bufIsChanged(buf2)
|
|
|
22c937 |
&& (buf2->b_ffname != NULL
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 1480,1486 ****
|
|
|
22c937 |
return bufIsChanged(buf);
|
|
|
22c937 |
}
|
|
|
22c937 |
#endif
|
|
|
22c937 |
! EMSG(_(e_nowrtmsg));
|
|
|
22c937 |
return TRUE;
|
|
|
22c937 |
}
|
|
|
22c937 |
return FALSE;
|
|
|
22c937 |
--- 1480,1489 ----
|
|
|
22c937 |
return bufIsChanged(buf);
|
|
|
22c937 |
}
|
|
|
22c937 |
#endif
|
|
|
22c937 |
! if (flags & CCGD_EXCMD)
|
|
|
22c937 |
! EMSG(_(e_nowrtmsg));
|
|
|
22c937 |
! else
|
|
|
22c937 |
! EMSG(_(e_nowrtmsg_nobang));
|
|
|
22c937 |
return TRUE;
|
|
|
22c937 |
}
|
|
|
22c937 |
return FALSE;
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 1690,1696 ****
|
|
|
22c937 |
{
|
|
|
22c937 |
/* Try auto-writing the buffer. If this fails but the buffer no
|
|
|
22c937 |
* longer exists it's not changed, that's OK. */
|
|
|
22c937 |
! if (check_changed(buf, p_awa, TRUE, FALSE, TRUE) && buf_valid(buf))
|
|
|
22c937 |
break; /* didn't save - still changes */
|
|
|
22c937 |
}
|
|
|
22c937 |
}
|
|
|
22c937 |
--- 1693,1701 ----
|
|
|
22c937 |
{
|
|
|
22c937 |
/* Try auto-writing the buffer. If this fails but the buffer no
|
|
|
22c937 |
* longer exists it's not changed, that's OK. */
|
|
|
22c937 |
! if (check_changed(buf, (p_awa ? CCGD_AW : 0)
|
|
|
22c937 |
! | CCGD_MULTWIN
|
|
|
22c937 |
! | CCGD_ALLBUF) && buf_valid(buf))
|
|
|
22c937 |
break; /* didn't save - still changes */
|
|
|
22c937 |
}
|
|
|
22c937 |
}
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 2274,2280 ****
|
|
|
22c937 |
vim_free(p);
|
|
|
22c937 |
}
|
|
|
22c937 |
if ((!P_HID(curbuf) || !other)
|
|
|
22c937 |
! && check_changed(curbuf, TRUE, !other, eap->forceit, FALSE))
|
|
|
22c937 |
return;
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
--- 2279,2288 ----
|
|
|
22c937 |
vim_free(p);
|
|
|
22c937 |
}
|
|
|
22c937 |
if ((!P_HID(curbuf) || !other)
|
|
|
22c937 |
! && check_changed(curbuf, CCGD_AW
|
|
|
22c937 |
! | (other ? 0 : CCGD_MULTWIN)
|
|
|
22c937 |
! | (eap->forceit ? CCGD_FORCEIT : 0)
|
|
|
22c937 |
! | CCGD_EXCMD))
|
|
|
22c937 |
return;
|
|
|
22c937 |
}
|
|
|
22c937 |
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 2315,2321 ****
|
|
|
22c937 |
*/
|
|
|
22c937 |
if ( P_HID(curbuf)
|
|
|
22c937 |
|| eap->cmdidx == CMD_snext
|
|
|
22c937 |
! || !check_changed(curbuf, TRUE, FALSE, eap->forceit, FALSE))
|
|
|
22c937 |
{
|
|
|
22c937 |
if (*eap->arg != NUL) /* redefine file list */
|
|
|
22c937 |
{
|
|
|
22c937 |
--- 2323,2331 ----
|
|
|
22c937 |
*/
|
|
|
22c937 |
if ( P_HID(curbuf)
|
|
|
22c937 |
|| eap->cmdidx == CMD_snext
|
|
|
22c937 |
! || !check_changed(curbuf, CCGD_AW
|
|
|
22c937 |
! | (eap->forceit ? CCGD_FORCEIT : 0)
|
|
|
22c937 |
! | CCGD_EXCMD))
|
|
|
22c937 |
{
|
|
|
22c937 |
if (*eap->arg != NUL) /* redefine file list */
|
|
|
22c937 |
{
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 2458,2464 ****
|
|
|
22c937 |
if (eap->cmdidx == CMD_windo
|
|
|
22c937 |
|| eap->cmdidx == CMD_tabdo
|
|
|
22c937 |
|| P_HID(curbuf)
|
|
|
22c937 |
! || !check_changed(curbuf, TRUE, FALSE, eap->forceit, FALSE))
|
|
|
22c937 |
{
|
|
|
22c937 |
/* start at the first argument/window/buffer */
|
|
|
22c937 |
i = 0;
|
|
|
22c937 |
--- 2468,2476 ----
|
|
|
22c937 |
if (eap->cmdidx == CMD_windo
|
|
|
22c937 |
|| eap->cmdidx == CMD_tabdo
|
|
|
22c937 |
|| P_HID(curbuf)
|
|
|
22c937 |
! || !check_changed(curbuf, CCGD_AW
|
|
|
22c937 |
! | (eap->forceit ? CCGD_FORCEIT : 0)
|
|
|
22c937 |
! | CCGD_EXCMD))
|
|
|
22c937 |
{
|
|
|
22c937 |
/* start at the first argument/window/buffer */
|
|
|
22c937 |
i = 0;
|
|
|
22c937 |
*** ../vim-7.4.081/src/proto/ex_cmds2.pro 2013-08-10 13:37:10.000000000 +0200
|
|
|
22c937 |
--- src/proto/ex_cmds2.pro 2013-11-09 03:18:02.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 35,41 ****
|
|
|
22c937 |
int prof_def_func __ARGS((void));
|
|
|
22c937 |
int autowrite __ARGS((buf_T *buf, int forceit));
|
|
|
22c937 |
void autowrite_all __ARGS((void));
|
|
|
22c937 |
! int check_changed __ARGS((buf_T *buf, int checkaw, int mult_win, int forceit, int allbuf));
|
|
|
22c937 |
void browse_save_fname __ARGS((buf_T *buf));
|
|
|
22c937 |
void dialog_changed __ARGS((buf_T *buf, int checkall));
|
|
|
22c937 |
int can_abandon __ARGS((buf_T *buf, int forceit));
|
|
|
22c937 |
--- 35,41 ----
|
|
|
22c937 |
int prof_def_func __ARGS((void));
|
|
|
22c937 |
int autowrite __ARGS((buf_T *buf, int forceit));
|
|
|
22c937 |
void autowrite_all __ARGS((void));
|
|
|
22c937 |
! int check_changed __ARGS((buf_T *buf, int flags));
|
|
|
22c937 |
void browse_save_fname __ARGS((buf_T *buf));
|
|
|
22c937 |
void dialog_changed __ARGS((buf_T *buf, int checkall));
|
|
|
22c937 |
int can_abandon __ARGS((buf_T *buf, int forceit));
|
|
|
22c937 |
*** ../vim-7.4.081/src/globals.h 2013-07-04 19:53:44.000000000 +0200
|
|
|
22c937 |
--- src/globals.h 2013-11-09 03:05:54.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 1490,1495 ****
|
|
|
22c937 |
--- 1490,1496 ----
|
|
|
22c937 |
EXTERN char_u e_notopen[] INIT(= N_("E484: Can't open file %s"));
|
|
|
22c937 |
EXTERN char_u e_notread[] INIT(= N_("E485: Can't read file %s"));
|
|
|
22c937 |
EXTERN char_u e_nowrtmsg[] INIT(= N_("E37: No write since last change (add ! to override)"));
|
|
|
22c937 |
+ EXTERN char_u e_nowrtmsg_nobang[] INIT(= N_("E37: No write since last change"));
|
|
|
22c937 |
EXTERN char_u e_null[] INIT(= N_("E38: Null argument"));
|
|
|
22c937 |
#ifdef FEAT_DIGRAPHS
|
|
|
22c937 |
EXTERN char_u e_number_exp[] INIT(= N_("E39: Number expected"));
|
|
|
22c937 |
*** ../vim-7.4.081/src/ex_cmds.c 2013-10-02 18:43:00.000000000 +0200
|
|
|
22c937 |
--- src/ex_cmds.c 2013-11-09 03:19:25.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 3253,3260 ****
|
|
|
22c937 |
if ( ((!other_file && !(flags & ECMD_OLDBUF))
|
|
|
22c937 |
|| (curbuf->b_nwindows == 1
|
|
|
22c937 |
&& !(flags & (ECMD_HIDE | ECMD_ADDBUF))))
|
|
|
22c937 |
! && check_changed(curbuf, p_awa, !other_file,
|
|
|
22c937 |
! (flags & ECMD_FORCEIT), FALSE))
|
|
|
22c937 |
{
|
|
|
22c937 |
if (fnum == 0 && other_file && ffname != NULL)
|
|
|
22c937 |
(void)setaltfname(ffname, sfname, newlnum < 0 ? 0 : newlnum);
|
|
|
22c937 |
--- 3253,3262 ----
|
|
|
22c937 |
if ( ((!other_file && !(flags & ECMD_OLDBUF))
|
|
|
22c937 |
|| (curbuf->b_nwindows == 1
|
|
|
22c937 |
&& !(flags & (ECMD_HIDE | ECMD_ADDBUF))))
|
|
|
22c937 |
! && check_changed(curbuf, (p_awa ? CCGD_AW : 0)
|
|
|
22c937 |
! | (other_file ? 0 : CCGD_MULTWIN)
|
|
|
22c937 |
! | ((flags & ECMD_FORCEIT) ? CCGD_FORCEIT : 0)
|
|
|
22c937 |
! | (eap == NULL ? 0 : CCGD_EXCMD)))
|
|
|
22c937 |
{
|
|
|
22c937 |
if (fnum == 0 && other_file && ffname != NULL)
|
|
|
22c937 |
(void)setaltfname(ffname, sfname, newlnum < 0 ? 0 : newlnum);
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 7664,7670 ****
|
|
|
22c937 |
# ifdef FEAT_WINDOWS
|
|
|
22c937 |
++emsg_off;
|
|
|
22c937 |
# endif
|
|
|
22c937 |
! split = check_changed(curbuf, TRUE, FALSE, FALSE, FALSE);
|
|
|
22c937 |
# ifdef FEAT_WINDOWS
|
|
|
22c937 |
--emsg_off;
|
|
|
22c937 |
# else
|
|
|
22c937 |
--- 7666,7672 ----
|
|
|
22c937 |
# ifdef FEAT_WINDOWS
|
|
|
22c937 |
++emsg_off;
|
|
|
22c937 |
# endif
|
|
|
22c937 |
! split = check_changed(curbuf, CCGD_AW | CCGD_EXCMD);
|
|
|
22c937 |
# ifdef FEAT_WINDOWS
|
|
|
22c937 |
--emsg_off;
|
|
|
22c937 |
# else
|
|
|
22c937 |
*** ../vim-7.4.081/src/ex_docmd.c 2013-11-08 04:30:06.000000000 +0100
|
|
|
22c937 |
--- src/ex_docmd.c 2013-11-09 03:30:10.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 6565,6571 ****
|
|
|
22c937 |
if (check_more(FALSE, eap->forceit) == OK && only_one_window())
|
|
|
22c937 |
exiting = TRUE;
|
|
|
22c937 |
if ((!P_HID(curbuf)
|
|
|
22c937 |
! && check_changed(curbuf, p_awa, FALSE, eap->forceit, FALSE))
|
|
|
22c937 |
|| check_more(TRUE, eap->forceit) == FAIL
|
|
|
22c937 |
|| (only_one_window() && check_changed_any(eap->forceit)))
|
|
|
22c937 |
{
|
|
|
22c937 |
--- 6565,6573 ----
|
|
|
22c937 |
if (check_more(FALSE, eap->forceit) == OK && only_one_window())
|
|
|
22c937 |
exiting = TRUE;
|
|
|
22c937 |
if ((!P_HID(curbuf)
|
|
|
22c937 |
! && check_changed(curbuf, (p_awa ? CCGD_AW : 0)
|
|
|
22c937 |
! | (eap->forceit ? CCGD_FORCEIT : 0)
|
|
|
22c937 |
! | CCGD_EXCMD))
|
|
|
22c937 |
|| check_more(TRUE, eap->forceit) == FAIL
|
|
|
22c937 |
|| (only_one_window() && check_changed_any(eap->forceit)))
|
|
|
22c937 |
{
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 7099,7105 ****
|
|
|
22c937 |
if (!P_HID(curbuf) && !split)
|
|
|
22c937 |
{
|
|
|
22c937 |
++emsg_off;
|
|
|
22c937 |
! split = check_changed(curbuf, TRUE, FALSE, FALSE, FALSE);
|
|
|
22c937 |
--emsg_off;
|
|
|
22c937 |
}
|
|
|
22c937 |
if (split)
|
|
|
22c937 |
--- 7101,7107 ----
|
|
|
22c937 |
if (!P_HID(curbuf) && !split)
|
|
|
22c937 |
{
|
|
|
22c937 |
++emsg_off;
|
|
|
22c937 |
! split = check_changed(curbuf, CCGD_AW);
|
|
|
22c937 |
--emsg_off;
|
|
|
22c937 |
}
|
|
|
22c937 |
if (split)
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 7361,7367 ****
|
|
|
22c937 |
{
|
|
|
22c937 |
/* Set recoverymode right away to avoid the ATTENTION prompt. */
|
|
|
22c937 |
recoverymode = TRUE;
|
|
|
22c937 |
! if (!check_changed(curbuf, p_awa, TRUE, eap->forceit, FALSE)
|
|
|
22c937 |
&& (*eap->arg == NUL
|
|
|
22c937 |
|| setfname(curbuf, eap->arg, NULL, TRUE) == OK))
|
|
|
22c937 |
ml_recover();
|
|
|
22c937 |
--- 7363,7373 ----
|
|
|
22c937 |
{
|
|
|
22c937 |
/* Set recoverymode right away to avoid the ATTENTION prompt. */
|
|
|
22c937 |
recoverymode = TRUE;
|
|
|
22c937 |
! if (!check_changed(curbuf, (p_awa ? CCGD_AW : 0)
|
|
|
22c937 |
! | CCGD_MULTWIN
|
|
|
22c937 |
! | (eap->forceit ? CCGD_FORCEIT : 0)
|
|
|
22c937 |
! | CCGD_EXCMD)
|
|
|
22c937 |
!
|
|
|
22c937 |
&& (*eap->arg == NUL
|
|
|
22c937 |
|| setfname(curbuf, eap->arg, NULL, TRUE) == OK))
|
|
|
22c937 |
ml_recover();
|
|
|
22c937 |
*** ../vim-7.4.081/src/version.c 2013-11-09 02:32:15.000000000 +0100
|
|
|
22c937 |
--- src/version.c 2013-11-09 03:26:06.000000000 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 740,741 ****
|
|
|
22c937 |
--- 740,743 ----
|
|
|
22c937 |
{ /* Add new patch number below this line */
|
|
|
22c937 |
+ /**/
|
|
|
22c937 |
+ 82,
|
|
|
22c937 |
/**/
|
|
|
22c937 |
|
|
|
22c937 |
--
|
|
|
22c937 |
People who want to share their religious views with you
|
|
|
22c937 |
almost never want you to share yours with them.
|
|
|
22c937 |
|
|
|
22c937 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
|
22c937 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
|
22c937 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
|
22c937 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|