comparison src/channel.c @ 22077:335365fcbb60 v8.2.1588

patch 8.2.1588: cannot read back the prompt of a prompt buffer Commit: https://github.com/vim/vim/commit/077cc7aa0e0c431e97795612374fe17fe7c88803 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Sep 4 16:35:35 2020 +0200 patch 8.2.1588: cannot read back the prompt of a prompt buffer Problem: Cannot read back the prompt of a prompt buffer. Solution: Add prompt_getprompt(). (Ben Jackson, closes https://github.com/vim/vim/issues/6851)
author Bram Moolenaar <Bram@vim.org>
date Fri, 04 Sep 2020 16:45:04 +0200
parents d9acf1e1c799
children 2cc0de1e05a6
comparison
equal deleted inserted replaced
22076:1b8ace0b3487 22077:335365fcbb60
6366 6366
6367 free_callback(&buf->b_prompt_interrupt); 6367 free_callback(&buf->b_prompt_interrupt);
6368 set_callback(&buf->b_prompt_interrupt, &callback); 6368 set_callback(&buf->b_prompt_interrupt, &callback);
6369 } 6369 }
6370 6370
6371
6372 /*
6373 * "prompt_getprompt({buffer})" function
6374 */
6375 void
6376 f_prompt_getprompt(typval_T *argvars, typval_T *rettv)
6377 {
6378 buf_T *buf;
6379
6380 // return an empty string by default, e.g. it's not a prompt buffer
6381 rettv->v_type = VAR_STRING;
6382 rettv->vval.v_string = NULL;
6383
6384 buf = tv_get_buf_from_arg(&argvars[0]);
6385 if (buf == NULL)
6386 return;
6387
6388 if (!bt_prompt(buf))
6389 return;
6390
6391 rettv->vval.v_string = vim_strsave(buf_prompt_text(buf));
6392 }
6393
6371 /* 6394 /*
6372 * "prompt_setprompt({buffer}, {text})" function 6395 * "prompt_setprompt({buffer}, {text})" function
6373 */ 6396 */
6374 void 6397 void
6375 f_prompt_setprompt(typval_T *argvars, typval_T *rettv UNUSED) 6398 f_prompt_setprompt(typval_T *argvars, typval_T *rettv UNUSED)