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:
@@ -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 */
|
||||
|
Reference in New Issue
Block a user