To: vim_dev@googlegroups.com Subject: Patch 8.0.0953 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0953 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. Files: src/globals.h, src/buffer.c, src/proto/buffer.pro, src/ex_cmds.c, src/ex_cmds2.c, src/ex_docmd.c, src/quickfix.c, src/terminal.c *** ../vim-8.0.0952/src/globals.h 2017-08-14 22:35:04.676303049 +0200 --- src/globals.h 2017-08-17 16:17:39.988155983 +0200 *************** *** 1516,1523 **** EXTERN char_u e_notmp[] INIT(= N_("E483: Can't get temp file name")); EXTERN char_u e_notopen[] INIT(= N_("E484: Can't open file %s")); EXTERN char_u e_notread[] INIT(= N_("E485: Can't read file %s")); - EXTERN char_u e_nowrtmsg[] INIT(= N_("E37: No write since last change (add ! to override)")); - EXTERN char_u e_nowrtmsg_nobang[] INIT(= N_("E37: No write since last change")); EXTERN char_u e_null[] INIT(= N_("E38: Null argument")); #if defined(FEAT_DIGRAPHS) || defined(FEAT_TIMERS) EXTERN char_u e_number_exp[] INIT(= N_("E39: Number expected")); --- 1516,1521 ---- *** ../vim-8.0.0952/src/buffer.c 2017-08-13 20:43:44.157865705 +0200 --- src/buffer.c 2017-08-17 16:44:21.457688264 +0200 *************** *** 473,480 **** { if (term_job_running(buf->b_term)) { ! if (wipe_buf) ! /* Wiping out a terminal buffer kills the job. */ free_terminal(buf); else { --- 473,480 ---- { if (term_job_running(buf->b_term)) { ! if (wipe_buf || unload_buf) ! /* Wiping out or unloading a terminal buffer kills the job. */ free_terminal(buf); else { *************** *** 1648,1654 **** if (bufIsChanged(curbuf)) #endif { ! EMSG(_(e_nowrtmsg)); return FAIL; } } --- 1648,1654 ---- if (bufIsChanged(curbuf)) #endif { ! no_write_message(); return FAIL; } } *************** *** 1897,1902 **** --- 1897,1924 ---- } #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 */ *** ../vim-8.0.0952/src/proto/buffer.pro 2017-08-04 21:37:48.732574980 +0200 --- src/proto/buffer.pro 2017-08-17 16:21:39.634608895 +0200 *************** *** 13,18 **** --- 13,20 ---- void set_curbuf(buf_T *buf, int action); void enter_buffer(buf_T *buf); void do_autochdir(void); + void no_write_message(void); + void no_write_message_nobang(void); buf_T *buflist_new(char_u *ffname, char_u *sfname, linenr_T lnum, int flags); void free_buf_options(buf_T *buf, int free_p_ff); int buflist_getfile(int n, linenr_T lnum, int options, int forceit); *** ../vim-8.0.0952/src/ex_cmds.c 2017-08-03 22:44:51.038797722 +0200 --- src/ex_cmds.c 2017-08-17 16:22:12.162396216 +0200 *************** *** 3572,3578 **** { if (other) --no_wait_return; ! EMSG(_(e_nowrtmsg)); retval = GETFILE_NOT_WRITTEN; /* file has been changed */ goto theend; } --- 3572,3578 ---- { if (other) --no_wait_return; ! no_write_message(); retval = GETFILE_NOT_WRITTEN; /* file has been changed */ goto theend; } *** ../vim-8.0.0952/src/ex_cmds2.c 2017-08-11 17:12:47.915619891 +0200 --- src/ex_cmds2.c 2017-08-17 16:18:02.292013532 +0200 *************** *** 1934,1942 **** } #endif if (flags & CCGD_EXCMD) ! EMSG(_(e_nowrtmsg)); else ! EMSG(_(e_nowrtmsg_nobang)); return TRUE; } return FALSE; --- 1934,1942 ---- } #endif if (flags & CCGD_EXCMD) ! no_write_message(); else ! no_write_message_nobang(); return TRUE; } return FALSE; *** ../vim-8.0.0952/src/ex_docmd.c 2017-08-06 15:22:10.301211970 +0200 --- src/ex_docmd.c 2017-08-17 16:16:30.564599420 +0200 *************** *** 7468,7474 **** else # endif { ! EMSG(_(e_nowrtmsg)); return; } } --- 7468,7474 ---- else # endif { ! no_write_message(); return; } } *** ../vim-8.0.0952/src/quickfix.c 2017-08-13 13:41:57.176413216 +0200 --- src/quickfix.c 2017-08-17 16:16:48.868482500 +0200 *************** *** 2327,2333 **** * set b_p_ro flag). */ if (!can_abandon(curbuf, forceit)) { ! EMSG(_(e_nowrtmsg)); ok = FALSE; } else --- 2327,2333 ---- * set b_p_ro flag). */ if (!can_abandon(curbuf, forceit)) { ! no_write_message(); ok = FALSE; } else *** ../vim-8.0.0952/src/terminal.c 2017-08-17 14:39:01.438293834 +0200 --- src/terminal.c 2017-08-17 16:17:13.344326161 +0200 *************** *** 267,273 **** /* Create a new buffer in the current window. */ if (!can_abandon(curbuf, forceit)) { ! EMSG(_(e_nowrtmsg)); vim_free(term); return; } --- 267,273 ---- /* Create a new buffer in the current window. */ if (!can_abandon(curbuf, forceit)) { ! no_write_message(); vim_free(term); return; } *** ../vim-8.0.0952/src/version.c 2017-08-17 14:39:01.438293834 +0200 --- src/version.c 2017-08-17 16:46:04.965003089 +0200 *************** *** 771,772 **** --- 771,774 ---- { /* Add new patch number below this line */ + /**/ + 953, /**/ -- Friends? I have lots of friends! In fact, I have all episodes ever made. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///