diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-09-02 01:54:49 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2019-09-01 22:54:49 -0700 |
commit | 7bb029eeef65f57d94cef4e4b709e6c3ebefcf08 (patch) | |
tree | 0d606d3f47f2e67df1e718655b476999275f10c4 | |
parent | 299331490eb037d355e58efbff8e9a7f3e026431 (diff) | |
download | rneovim-7bb029eeef65f57d94cef4e4b709e6c3ebefcf08.tar.gz rneovim-7bb029eeef65f57d94cef4e4b709e6c3ebefcf08.tar.bz2 rneovim-7bb029eeef65f57d94cef4e4b709e6c3ebefcf08.zip |
vim-patch:8.0.0858: check if job terminal is running #10908
Problem: Can exit while a terminal is still running a job.
Solution: Consider a buffer with a running job like a changed file.
https://github.com/vim/vim/commit/eb44a68b42eda207a5bc4def9ea8fc4d38acb650
-rw-r--r-- | src/nvim/option.c | 1 | ||||
-rw-r--r-- | src/nvim/undo.c | 11 |
2 files changed, 5 insertions, 7 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index 04349414a2..d1753526a7 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -6985,6 +6985,7 @@ void save_file_ff(buf_T *buf) /// When "ignore_empty" is true don't consider a new, empty buffer to be /// changed. bool file_ff_differs(buf_T *buf, bool ignore_empty) + FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT { // In a buffer that was never loaded the options are not valid. if (buf->b_flags & BF_NEVERLOADED) { diff --git a/src/nvim/undo.c b/src/nvim/undo.c index 1a31f6a6c7..c8343941d2 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -2962,7 +2962,7 @@ 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 + FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT { return !bt_dontwrite(buf) && (buf->b_changed || file_ff_differs(buf, true)); } @@ -2979,15 +2979,12 @@ bool anyBufIsChanged(void) 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. -/// +/// @see bufIsChanged /// @return true if the current buffer has changed bool curbufIsChanged(void) + FUNC_ATTR_WARN_UNUSED_RESULT { - return (!bt_dontwrite(curbuf) - && (curbuf->b_changed || file_ff_differs(curbuf, true))); + return bufIsChanged(curbuf); } /// Append the list of undo blocks to a newly allocated list |