vim-patch:8.1.1049: when user tries to exit with CTRL-C message is confusing
Problem: When user tries to exit with CTRL-C message is confusing. Solution: Only mention ":qa!" when there is a changed buffer. (closes vim/vim#4163)a84a3dd663
vim-patch:8.1.1052: test for CTRL-C message sometimes fails Problem: test for CTRL-C message sometimes fails Solution: Make sure there are no changed buffers.553e5a5c56
vim-patch:8.1.1053: warning for missing return statement Problem: Warning for missing return statement. (Dominique Pelle) Solution: Add return statement.d6c3f1fa2b
This commit is contained in:
parent
4c50f0dc76
commit
01e3690ca8
|
@ -7465,8 +7465,12 @@ static void nv_esc(cmdarg_T *cap)
|
|||
&& cmdwin_type == 0
|
||||
&& !VIsual_active
|
||||
&& no_reason) {
|
||||
MSG(_("Type :qa! and press <Enter> to abandon all changes"
|
||||
" and exit Nvim"));
|
||||
if (anyBufIsChanged()) {
|
||||
MSG(_("Type :qa! and press <Enter> to abandon all changes"
|
||||
" and exit Nvim"));
|
||||
} else {
|
||||
MSG(_("Type :qa and press <Enter> to exit Nvim"));
|
||||
}
|
||||
}
|
||||
|
||||
/* Don't reset "restart_edit" when 'insertmode' is set, it won't be
|
||||
|
|
|
@ -2552,6 +2552,21 @@ func Test_delete_until_paragraph()
|
|||
bwipe!
|
||||
endfunc
|
||||
|
||||
func Test_message_when_using_ctrl_c()
|
||||
" Make sure no buffers are changed.
|
||||
%bwipe!
|
||||
|
||||
exe "normal \<C-C>"
|
||||
call assert_match("Type :qa and press <Enter> to exit Nvim", 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 Nvim", Screenline(&lines))
|
||||
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" Test for '[m', ']m', '[M' and ']M'
|
||||
" Jumping to beginning and end of methods in Java-like languages
|
||||
func Test_java_motion()
|
||||
|
|
|
@ -2961,10 +2961,23 @@ static char_u *u_save_line(linenr_T lnum)
|
|||
///
|
||||
/// @return true if the buffer has changed
|
||||
bool bufIsChanged(buf_T *buf)
|
||||
FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
return !bt_dontwrite(buf) && (buf->b_changed || file_ff_differs(buf, true));
|
||||
}
|
||||
|
||||
// Return true if any buffer has changes. Also buffers that are not written.
|
||||
bool anyBufIsChanged(void)
|
||||
FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
FOR_ALL_BUFFERS(buf) {
|
||||
if (bufIsChanged(buf)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// Check if the 'modified' flag is set, or 'ff' has changed (only need to
|
||||
/// check the first character, because it can only be "dos", "unix" or "mac").
|
||||
/// "nofile" and "scratch" type buffers are considered to always be unchanged.
|
||||
|
|
|
@ -275,7 +275,7 @@ describe('system()', function()
|
|||
~ |
|
||||
~ |
|
||||
~ |
|
||||
Type :qa! and press <E...all changes and exit Nvim |
|
||||
Type :qa and press <Enter> to exit Nvim |
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
@ -481,7 +481,7 @@ describe('systemlist()', function()
|
|||
~ |
|
||||
~ |
|
||||
~ |
|
||||
Type :qa! and press <E...all changes and exit Nvim |
|
||||
Type :qa and press <Enter> to exit Nvim |
|
||||
]])
|
||||
end)
|
||||
end)
|
||||
|
|
|
@ -494,7 +494,7 @@ describe('Command-line coloring', function()
|
|||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
{EOB:~ }|
|
||||
Type :qa! and pr...nges and exit Nvim |
|
||||
Type :qa and pre...nter> to exit Nvim |
|
||||
]])
|
||||
end)
|
||||
it('works fine with NUL, NL, CR', function()
|
||||
|
|
|
@ -631,7 +631,7 @@ describe('ui/ext_messages', function()
|
|||
{1:~ }|
|
||||
{1:~ }|
|
||||
]], messages={{
|
||||
content = {{ "Type :qa! and press <Enter> to abandon all changes and exit Nvim" }},
|
||||
content = {{ "Type :qa and press <Enter> to exit Nvim" }},
|
||||
kind = ""}
|
||||
}}
|
||||
|
||||
|
@ -678,7 +678,7 @@ describe('ui/ext_messages', function()
|
|||
{1:~ }|
|
||||
]], messages={
|
||||
{kind="echomsg", content={{"howdy"}}},
|
||||
{kind="", content={{"Type :qa! and press <Enter> to abandon all changes and exit Nvim"}}},
|
||||
{kind="", content={{"Type :qa and press <Enter> to exit Nvim"}}},
|
||||
{kind="echoerr", content={{"bork", 2}}},
|
||||
{kind="emsg", content={{"E117: Unknown function: nosuchfunction", 2}}}
|
||||
}}
|
||||
|
|
Loading…
Reference in New Issue