Problem: When user tries to exit with CTRL-C message is confusing.
Solution: Only mention ":qa!" when there is a changed buffer. (closes #4163)
#endif
&& !VIsual_active
&& no_reason)
- msg(_("Type :qa! and press <Enter> to abandon all changes and exit Vim"));
+ {
+ if (anyBufIsChanged())
+ msg(_("Type :qa! and press <Enter> to abandon all changes and exit Vim"));
+ else
+ msg(_("Type :qa and press <Enter> to exit Vim"));
+ }
/* Don't reset "restart_edit" when 'insertmode' is set, it won't be
* set again below when halfway a mapping. */
void u_undoline(void);
void u_blockfree(buf_T *buf);
int bufIsChanged(buf_T *buf);
+int anyBufIsChanged(void);
int bufIsChangedNotTerm(buf_T *buf);
int curbufIsChanged(void);
void u_eval_tree(u_header_T *first_uhp, list_T *list);
" Test for various Normal mode commands
+source shared.vim
+
func Setup_NewWindow()
10new
call setline(1, range(1,100))
%bwipeout!
endfunc
+
+func Test_message_when_using_ctrl_c()
+ exe "normal \<C-C>"
+ call assert_match("Type :qa and press <Enter> to exit Vim", Screenline(&lines))
+ new
+ cal setline(1, 'hi!')
+ exe "normal \<C-C>"
+ call assert_match("Type :qa! and press <Enter> to abandon all changes and exit Vim", Screenline(&lines))
+ bwipe!
+endfunc
return bufIsChangedNotTerm(buf);
}
+/*
+ * Return TRUE if any buffer has changes. Also buffers that are not written.
+ */
+ int
+anyBufIsChanged(void)
+{
+ buf_T *buf;
+
+ FOR_ALL_BUFFERS(buf)
+ if (bufIsChanged(buf))
+ return TRUE;
+}
+
/*
* Like bufIsChanged() but ignoring a terminal window.
*/
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1049,
/**/
1048,
/**/