]> granicus.if.org Git - vim/commitdiff
patch 8.0.1382: get "no write since last change" message if terminal is open v8.0.1382
authorBram Moolenaar <Bram@vim.org>
Sat, 9 Dec 2017 18:51:49 +0000 (19:51 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 9 Dec 2017 18:51:49 +0000 (19:51 +0100)
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.

src/ex_cmds.c
src/proto/undo.pro
src/undo.c
src/version.c

index fc55815517a619057a19e3d1954ffca244873ffd..cd8b0c3f57349add47bb4d20404f559b25fa1314 100644 (file)
@@ -1482,7 +1482,7 @@ do_shell(
 #endif
                && msg_silent == 0)
        FOR_ALL_BUFFERS(buf)
-           if (bufIsChanged(buf))
+           if (bufIsChangedNotTerm(buf))
            {
 #ifdef FEAT_GUI_MSWIN
                if (!winstart)
index 2b3258df3a45414b3bd0eebf99e4e8cf18e57fc8..1052d40c2bf995e63a19b329bd343cffb7520b12 100644 (file)
@@ -25,6 +25,7 @@ void u_clearline(void);
 void u_undoline(void);
 void u_blockfree(buf_T *buf);
 int bufIsChanged(buf_T *buf);
+int bufIsChangedNotTerm(buf_T *buf);
 int curbufIsChanged(void);
 void u_eval_tree(u_header_T *first_uhp, list_T *list);
 /* vim: set ft=c : */
index 435decc3ae000dfa9acb7a74d3944be3eb35530b..69d4fc603004f77c31213499a189a8f194c2d96e 100644 (file)
@@ -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));
 }
index 8ae4769504cf01b18858c1a6a98854a709b11e79..3c24cf92d5690125e0d54bdd1334e1b7cb54fc1c 100644 (file)
@@ -771,6 +771,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1382,
 /**/
     1381,
 /**/