diff src/undo.c @ 13012:8d5b451d7bab v8.0.1382

patch 8.0.1382: get "no write since last change" message if terminal is open commit https://github.com/vim/vim/commit/f405c8fe85bba6dc96a68a12ab976f745fc51a38 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Dec 9 19:51:49 2017 +0100 patch 8.0.1382: get "no write since last change" message if terminal is open Problem: Get "no write since last change" message if a terminal is open. (Fritz mehner) Solution: Don't consider a buffer changed if it's a terminal window.
author Christian Brabandt <cb@256bit.org>
date Sat, 09 Dec 2017 20:00:06 +0100
parents ff494a964ab7
children c4b5ad2b3596
line wrap: on
line diff
--- a/src/undo.c
+++ b/src/undo.c
@@ -3523,6 +3523,8 @@ u_save_line(linenr_T lnum)
  * 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.
+ * Also considers a buffer changed when a terminal window contains a running
+ * job.
  */
     int
 bufIsChanged(buf_T *buf)
@@ -3531,6 +3533,15 @@ bufIsChanged(buf_T *buf)
     if (term_job_running(buf->b_term))
 	return TRUE;
 #endif
+    return bufIsChangedNotTerm(buf);
+}
+
+/*
+ * Like bufIsChanged() but ignoring a terminal window.
+ */
+    int
+bufIsChangedNotTerm(buf_T *buf)
+{
     return !bt_dontwrite(buf)
 	&& (buf->b_changed || file_ff_differs(buf, TRUE));
 }