diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-07-28 20:36:51 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-07-28 22:19:11 -0400 |
commit | 01e3690ca870276bfdc78d81a1bd75b7f1a78a9e (patch) | |
tree | 954367e565bb18629262b83bdd3fc3905250f972 /src/nvim/undo.c | |
parent | 4c50f0dc7640ca11bbe1aea51e5b95b4f974347d (diff) | |
download | rneovim-01e3690ca870276bfdc78d81a1bd75b7f1a78a9e.tar.gz rneovim-01e3690ca870276bfdc78d81a1bd75b7f1a78a9e.tar.bz2 rneovim-01e3690ca870276bfdc78d81a1bd75b7f1a78a9e.zip |
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)
https://github.com/vim/vim/commit/a84a3dd6635fcd2e07f510cba6a999585dcc381a
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.
https://github.com/vim/vim/commit/553e5a5c568e7d175b65b0472cd6d9843b25f4c8
vim-patch:8.1.1053: warning for missing return statement
Problem: Warning for missing return statement. (Dominique Pelle)
Solution: Add return statement.
https://github.com/vim/vim/commit/d6c3f1fa2b5e1dd7dc87cf608d72b84ad696b58f
Diffstat (limited to 'src/nvim/undo.c')
-rw-r--r-- | src/nvim/undo.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/nvim/undo.c b/src/nvim/undo.c index c9b0d96866..1305e013ad 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -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. |