]> granicus.if.org Git - vim/commitdiff
patch 8.0.1013: terminal window behaves different from a buffer with changes v8.0.1013
authorBram Moolenaar <Bram@vim.org>
Tue, 29 Aug 2017 20:44:59 +0000 (22:44 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 29 Aug 2017 20:44:59 +0000 (22:44 +0200)
Problem:    A terminal window with a running job behaves different from a
            window containing a changed buffer.
Solution:   Do not set 'bufhidden' to "hide".  Fix that a buffer where a
            terminal used to run is listed as "[Scratch]".

runtime/doc/terminal.txt
src/buffer.c
src/terminal.c
src/version.c

index fd0a0ace4ac5ba54bda1013f3a24d6dd27a6ec77..9e903d26a4feaaedea815824f45d5fd453f0e435 100644 (file)
@@ -1,4 +1,4 @@
-*terminal.txt* For Vim version 8.0.  Last change: 2017 Aug 26
+*terminal.txt* For Vim version 8.0.  Last change: 2017 Aug 29
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -140,11 +140,17 @@ Syntax ~
 When the buffer associated with the terminal is unloaded or wiped out the job
 is killed, similar to calling `job_stop(job, "kill")`
 
-By default the 'bufhidden' option of the buffer will be set to "hide".
-So long as the job is running: If the window is closed the buffer becomes
-hidden.  The command will not be stopped.  The `:buffer` command can be used
-to turn the current window into a terminal window.  If there are unsaved
-changes this fails, use ! to force, as usual.
+So long as the job is running the window behaves like it contains a modified
+buffer.  Trying to close the window with `CTRL-W :close` or `CTRL-W :hide`
+fails, unless "!" is added, in which case the job is ended.  The text in the
+window is lost.  The buffer still exists, but getting it in a window with
+`:buffer` will show an
+empty buffer.
+
+You can use `CTRL-W :hide` to close the terminal window and make the buffer
+hidden, the job keeps running.  The `:buffer` command can be used to turn the
+current window into a terminal window.  If there are unsaved changes this
+fails, use !  to force, as usual.
 
 To have a background job run without a window, and open the window when it's
 done, use options like this: >
index f64255d7856d1fc512630ff74c2d71e548594673..e95abfa5af72f7e5287eec83c844e2142641f718 100644 (file)
@@ -5825,8 +5825,8 @@ buf_spname(buf_T *buf)
        if (buf->b_term != NULL)
            return term_get_status_text(buf->b_term);
 #endif
-       if (buf->b_sfname != NULL)
-           return buf->b_sfname;
+       if (buf->b_fname != NULL)
+           return buf->b_fname;
        return (char_u *)_("[Scratch]");
     }
 
index 288ad28eb6070efd3e809f74af3d3584c74de3ce..b2a3e7f3d33128ae0f6193779e553b2e385139fb 100644 (file)
  * - add test for giving error for invalid 'termsize' value.
  * - support minimal size when 'termsize' is "rows*cols".
  * - support minimal size when 'termsize' is empty?
- * - do not set bufhidden to "hide"?  works like a buffer with changes.
- *   document that CTRL-W :hide can be used.
  * - GUI: when using tabs, focus in terminal, click on tab does not work.
- * - When $HOME was set by Vim (MS-Windows), do not pass it to the job.
  * - GUI: when 'confirm' is set and trying to exit Vim, dialog offers to save
  *   changes to "!shell".
  *   (justrajdeep, 2017 Aug 22)
@@ -399,10 +396,6 @@ term_start(typval_T *argvar, jobopt_T *opt, int forceit)
      * the job finished. */
     curbuf->b_p_ma = FALSE;
 
-    /* Set 'bufhidden' to "hide": allow closing the window. */
-    set_string_option_direct((char_u *)"bufhidden", -1,
-                                     (char_u *)"hide", OPT_FREE|OPT_LOCAL, 0);
-
     set_term_and_win_size(term);
     setup_job_options(opt, term->tl_rows, term->tl_cols);
 
index 3be91c249ac804a15ef0d686ec050e86054a5ec5..26604fd135c439c06bad87823e1862b84d18b96a 100644 (file)
@@ -769,6 +769,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1013,
 /**/
     1012,
 /**/