aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/undo.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-07-29 20:59:38 +0200
committerGitHub <noreply@github.com>2019-07-29 20:59:38 +0200
commitbae02eb3968be1c9677283d030fbbe6dd02cb180 (patch)
tree826839463784f5464c8b4203eafc1c0d98205b91 /src/nvim/undo.c
parent6e03f87e0991b5b0dfffa79ae580b87e40468da1 (diff)
parentd6b31721bfadabf5eaa817321706d403ecfbf805 (diff)
downloadrneovim-bae02eb3968be1c9677283d030fbbe6dd02cb180.tar.gz
rneovim-bae02eb3968be1c9677283d030fbbe6dd02cb180.tar.bz2
rneovim-bae02eb3968be1c9677283d030fbbe6dd02cb180.zip
Merge #10645 from janlazo/vim-8.1.0999
vim-patch:8.1.{1005,1041,1049,1052,1053,1086,1394}
Diffstat (limited to 'src/nvim/undo.c')
-rw-r--r--src/nvim/undo.c13
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.