1
0
forked from aniani/vim

patch 8.1.0069: cannot handle pressing CTRL-C in a prompt buffer

Problem:    Cannot handle pressing CTRL-C in a prompt buffer.
Solution:   Add prompt_setinterrupt().
This commit is contained in:
Bram Moolenaar
2018-06-17 19:36:33 +02:00
parent 2f82ca7d79
commit 0e5979a6d4
6 changed files with 98 additions and 13 deletions

View File

@@ -5856,7 +5856,7 @@ invoke_prompt_callback(void)
curwin->w_cursor.lnum = lnum + 1;
curwin->w_cursor.col = 0;
if (curbuf->b_prompt_callback == NULL)
if (curbuf->b_prompt_callback == NULL || *curbuf->b_prompt_callback == NUL)
return;
text = ml_get(lnum);
prompt = prompt_text();
@@ -5874,4 +5874,28 @@ invoke_prompt_callback(void)
clear_tv(&rettv);
}
/*
* Return TRUE when the interrupt callback was invoked.
*/
int
invoke_prompt_interrupt(void)
{
typval_T rettv;
int dummy;
typval_T argv[1];
if (curbuf->b_prompt_interrupt == NULL
|| *curbuf->b_prompt_interrupt == NUL)
return FALSE;
argv[0].v_type = VAR_UNKNOWN;
got_int = FALSE; // don't skip executing commands
call_func(curbuf->b_prompt_interrupt,
(int)STRLEN(curbuf->b_prompt_interrupt),
&rettv, 0, argv, NULL, 0L, 0L, &dummy, TRUE,
curbuf->b_prompt_int_partial, NULL);
clear_tv(&rettv);
return TRUE;
}
#endif /* FEAT_JOB_CHANNEL */