summaryrefslogtreecommitdiffstats
path: root/src/buffer.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-03-29 16:37:16 +0200
committerBram Moolenaar <Bram@vim.org>2018-03-29 16:37:16 +0200
commit0751f51a5b428805a8c1e9fe529693d032bec991 (patch)
tree73b25f3f4b0b3fc37e03ee5e3e84b64da6fe844d /src/buffer.c
parent0c72fe4ed8430db41f43c5878e6ee60265dc49e9 (diff)
patch 8.0.1651: cannot filter :ls output for terminal buffersv8.0.1651
Problem: Cannot filter :ls output for terminal buffers. Solution: Add flags for terminal buffers. (Marcin Szamotulski, closes #2751)
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 4b79840cb5..0e13e1f5d4 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2930,18 +2930,34 @@ buflist_list(exarg_T *eap)
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))
+ && (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))
+ && (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))