Patch 8.0.1651
Problem: Cannot filter :ls output for terminal buffers.
Solution: Add flags for terminal buffers. (Marcin Szamotulski, closes #2751)
Files: runtime/doc/windows.txt, src/buffer.c,
src/testdir/test_terminal.vim
*** ../vim-8.0.1650/runtime/doc/windows.txt 2018-02-12 22:07:45.593058158
+0100
--- runtime/doc/windows.txt 2018-03-29 16:21:35.150306274 +0200
***************
*** 1025,1030 ****
--- 1029,1037 ----
displayed in a window |hidden-buffer|
- a buffer with 'modifiable' off
= a readonly buffer
+ R a terminal buffer with a running job
+ F a terminal buffer with a finished job
+ ? a terminal buffer without a job: `:terminal NONE`
+ a modified buffer
x a buffer with read errors
***************
*** 1039,1044 ****
--- 1046,1054 ----
x buffers with a read error
% current buffer
# alternate buffer
+ R terminal buffers with a running job
+ F terminal buffers with a finished job
+ ? terminal buffers without a job: `:terminal NONE`
Combining flags means they are "and"ed together, e.g.:
h+ hidden buffers which are modified
a+ active buffers which are modified
***************
*** 1271,1276 ****
--- 1281,1289 ----
and can't be changed. The 'buflisted' option will be reset
for a help buffer.
+ terminal A terminal window buffer, see |terminal|. The contents cannot
+ be read or changed until the job ends.
+
directory Displays directory contents. Can be used by a file explorer
plugin. The buffer is created with these settings: >
:setlocal buftype=nowrite
*** ../vim-8.0.1650/src/buffer.c 2018-03-29 16:03:46.616035925 +0200
--- src/buffer.c 2018-03-29 16:25:43.281022534 +0200
***************
*** 2930,2947 ****
int i;
int ro_char;
int changed_char;
for (buf = firstbuf; buf != NULL && !got_int; buf = buf->b_next)
{
/* skip unlisted buffers, unless ! was used */
if ((!buf->b_p_bl && !eap->forceit && !vim_strchr(eap->arg, 'u'))
|| (vim_strchr(eap->arg, 'u') && buf->b_p_bl)
|| (vim_strchr(eap->arg, '+')
&& ((buf->b_flags & BF_READERR) || !bufIsChanged(buf)))
|| (vim_strchr(eap->arg, 'a')
! && (buf->b_ml.ml_mfp == NULL || buf->b_nwindows == 0))
|| (vim_strchr(eap->arg, 'h')
! && (buf->b_ml.ml_mfp == NULL || buf->b_nwindows != 0))
|| (vim_strchr(eap->arg, '-') && buf->b_p_ma)
|| (vim_strchr(eap->arg, '=') && !buf->b_p_ro)
|| (vim_strchr(eap->arg, 'x') && !(buf->b_flags & BF_READERR))
--- 2930,2963 ----
int i;
int ro_char;
int changed_char;
+ #ifdef FEAT_TERMINAL
+ int job_running;
+ int job_none_open;
+ #endif
for (buf = firstbuf; buf != NULL && !got_int; buf = buf->b_next)
{
+ #ifdef FEAT_TERMINAL
+ job_running = term_job_running(buf->b_term);
+ job_none_open = job_running && term_none_open(buf->b_term);
+ #endif
/* skip unlisted buffers, unless ! was used */
if ((!buf->b_p_bl && !eap->forceit && !vim_strchr(eap->arg, 'u'))
|| (vim_strchr(eap->arg, 'u') && buf->b_p_bl)
|| (vim_strchr(eap->arg, '+')
&& ((buf->b_flags & BF_READERR) || !bufIsChanged(buf)))
|| (vim_strchr(eap->arg, 'a')
! && (buf->b_ml.ml_mfp == NULL || buf->b_nwindows == 0))
|| (vim_strchr(eap->arg, 'h')
! && (buf->b_ml.ml_mfp == NULL || buf->b_nwindows != 0))
! #ifdef FEAT_TERMINAL
! || (vim_strchr(eap->arg, 'R')
! && (!job_running || (job_running && job_none_open)))
! || (vim_strchr(eap->arg, '?')
! && (!job_running || (job_running && !job_none_open)))
! || (vim_strchr(eap->arg, 'F')
! && (job_running || buf->b_term == NULL))
! #endif
|| (vim_strchr(eap->arg, '-') && buf->b_p_ma)
|| (vim_strchr(eap->arg, '=') && !buf->b_p_ro)
|| (vim_strchr(eap->arg, 'x') && !(buf->b_flags & BF_READERR))
*** ../vim-8.0.1650/src/testdir/test_terminal.vim 2018-03-26
21:38:45.196332620 +0200
--- src/testdir/test_terminal.vim 2018-03-29 16:29:51.447744297 +0200
***************
*** 45,55 ****
--- 45,61 ----
call assert_equal('t', mode())
call assert_equal('yes', b:done)
call assert_match('%aR[^\n]*running]', execute('ls'))
+ call assert_match('%aR[^\n]*running]', execute('ls R'))
+ call assert_notmatch('%[^\n]*running]', execute('ls F'))
+ call assert_notmatch('%[^\n]*running]', execute('ls ?'))
call Stop_shell_in_terminal(buf)
call term_wait(buf)
call assert_equal('n', mode())
call assert_match('%aF[^\n]*finished]', execute('ls'))
+ call assert_match('%aF[^\n]*finished]', execute('ls F'))
+ call assert_notmatch('%[^\n]*finished]', execute('ls R'))
+ call assert_notmatch('%[^\n]*finished]', execute('ls ?'))
" closing window wipes out the terminal buffer a with finished job
close
*** ../vim-8.0.1650/src/version.c 2018-03-29 16:03:46.620035905 +0200
--- src/version.c 2018-03-29 16:22:54.369895621 +0200
***************
*** 764,765 ****
--- 764,767 ----
{ /* Add new patch number below this line */
+ /**/
+ 1651,
/**/
--
>From "know your smileys":
¯\_(ツ)_/¯ Shrug
/// Bram Moolenaar -- [email protected] -- 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 ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.