Mercurial > vim
diff src/buffer.c @ 14019:dc67449d648c v8.1.0027
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
commit https://github.com/vim/vim/commit/f273245f6433d5d43a5671306b520a3230c35787
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 3 14:47:35 2018 +0200
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.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 03 Jun 2018 15:00:07 +0200 |
parents | fc03fabbedc5 |
children | afce2005fdc8 |
line wrap: on
line diff
--- a/src/buffer.c +++ b/src/buffer.c @@ -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); @@ -5634,6 +5638,15 @@ bt_help(buf_T *buf) } /* + * 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