0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.1.0027: difficult to make a plugin that feeds a line to a job

Problem:    Difficult to make a plugin that feeds a line to a job.
Solution:   Add the nitial code for the "prompt" buftype.
This commit is contained in:
Bram Moolenaar
2018-06-03 14:47:35 +02:00
parent 33c5e9fa7a
commit f273245f64
22 changed files with 532 additions and 58 deletions

View File

@@ -851,6 +851,10 @@ free_buffer(buf_T *buf)
#ifdef FEAT_TERMINAL
free_terminal(buf);
#endif
#ifdef FEAT_JOB_CHANNEL
vim_free(buf->b_prompt_text);
free_callback(buf->b_prompt_callback, buf->b_prompt_partial);
#endif
buf_hashtab_remove(buf);
@@ -5633,6 +5637,15 @@ bt_help(buf_T *buf)
return buf != NULL && buf->b_help;
}
/*
* Return TRUE if "buf" is a prompt buffer.
*/
int
bt_prompt(buf_T *buf)
{
return buf != NULL && buf->b_p_bt[0] == 'p';
}
/*
* Return TRUE if "buf" is a "nofile", "acwrite" or "terminal" buffer.
* This means the buffer name is not a file name.
@@ -5642,7 +5655,8 @@ bt_nofile(buf_T *buf)
{
return buf != NULL && ((buf->b_p_bt[0] == 'n' && buf->b_p_bt[2] == 'f')
|| buf->b_p_bt[0] == 'a'
|| buf->b_p_bt[0] == 't');
|| buf->b_p_bt[0] == 't'
|| buf->b_p_bt[0] == 'p');
}
/*
@@ -5651,7 +5665,9 @@ bt_nofile(buf_T *buf)
int
bt_dontwrite(buf_T *buf)
{
return buf != NULL && (buf->b_p_bt[0] == 'n' || buf->b_p_bt[0] == 't');
return buf != NULL && (buf->b_p_bt[0] == 'n'
|| buf->b_p_bt[0] == 't'
|| buf->b_p_bt[0] == 'p');
}
int