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.
eb44a68b42
This commit is contained in:
Jan Edmund Lazo
2019-09-02 01:54:49 -04:00
committed by Justin M. Keyes
parent 299331490e
commit 7bb029eeef
2 changed files with 5 additions and 7 deletions

View File

@@ -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 /// When "ignore_empty" is true don't consider a new, empty buffer to be
/// changed. /// changed.
bool file_ff_differs(buf_T *buf, bool ignore_empty) 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. // In a buffer that was never loaded the options are not valid.
if (buf->b_flags & BF_NEVERLOADED) { if (buf->b_flags & BF_NEVERLOADED) {

View File

@@ -2962,7 +2962,7 @@ static char_u *u_save_line(linenr_T lnum)
/// ///
/// @return true if the buffer has changed /// @return true if the buffer has changed
bool bufIsChanged(buf_T *buf) 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)); return !bt_dontwrite(buf) && (buf->b_changed || file_ff_differs(buf, true));
} }
@@ -2979,15 +2979,12 @@ bool anyBufIsChanged(void)
return false; return false;
} }
/// Check if the 'modified' flag is set, or 'ff' has changed (only need to /// @see bufIsChanged
/// check the first character, because it can only be "dos", "unix" or "mac").
/// "nofile" and "scratch" type buffers are considered to always be unchanged.
///
/// @return true if the current buffer has changed /// @return true if the current buffer has changed
bool curbufIsChanged(void) bool curbufIsChanged(void)
FUNC_ATTR_WARN_UNUSED_RESULT
{ {
return (!bt_dontwrite(curbuf) return bufIsChanged(curbuf);
&& (curbuf->b_changed || file_ff_differs(curbuf, true)));
} }
/// Append the list of undo blocks to a newly allocated list /// Append the list of undo blocks to a newly allocated list