diff src/buffer.c @ 12146:59c1e09cf1a9 v8.0.0953

patch 8.0.0953: get "no write since last change" error in terminal window commit https://github.com/vim/vim/commit/f5be7cd01642fafc4b7d68894eb60cca60c7a405 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Aug 17 16:55:13 2017 +0200 patch 8.0.0953: get "no write since last change" error in terminal window Problem: Get "no write since last change" error in terminal window. Solution: Use another message when closing a terminal window. Make ":quit!" also end the job.
author Christian Brabandt <cb@256bit.org>
date Thu, 17 Aug 2017 17:00:05 +0200
parents 7b3a3af7cefb
children e3bde71afff0
line wrap: on
line diff
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -473,8 +473,8 @@ close_buffer(
     {
 	if (term_job_running(buf->b_term))
 	{
-	    if (wipe_buf)
-		/* Wiping out a terminal buffer kills the job. */
+	    if (wipe_buf || unload_buf)
+		/* Wiping out or unloading a terminal buffer kills the job. */
 		free_terminal(buf);
 	    else
 	    {
@@ -1648,7 +1648,7 @@ do_buffer(
 	if (bufIsChanged(curbuf))
 #endif
 	{
-	    EMSG(_(e_nowrtmsg));
+	    no_write_message();
 	    return FAIL;
 	}
     }
@@ -1897,6 +1897,28 @@ do_autochdir(void)
 }
 #endif
 
+    void
+no_write_message(void)
+{
+#ifdef FEAT_TERMINAL
+    if (term_job_running(curbuf->b_term))
+	EMSG(_("E948: Job still running (add ! to end the job)"));
+    else
+#endif
+	EMSG(_("E37: No write since last change (add ! to override)"));
+}
+
+    void
+no_write_message_nobang(void)
+{
+#ifdef FEAT_TERMINAL
+    if (term_job_running(curbuf->b_term))
+	EMSG(_("E948: Job still running"));
+    else
+#endif
+	EMSG(_("E37: No write since last change"));
+}
+
 /*
  * functions for dealing with the buffer list
  */