diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-06-17 19:36:33 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-06-17 19:36:33 +0200 |
commit | 0e5979a6d491f68c4a8c86fab489016919329a6b (patch) | |
tree | 9b2ae8d0a64cefadf20aafd660a0fce2558dfe39 /src/channel.c | |
parent | 2f82ca7d79148ae931bf28a747ede06ba8a65de8 (diff) |
patch 8.1.0069: cannot handle pressing CTRL-C in a prompt bufferv8.1.0069
Problem: Cannot handle pressing CTRL-C in a prompt buffer.
Solution: Add prompt_setinterrupt().
Diffstat (limited to 'src/channel.c')
-rw-r--r-- | src/channel.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/channel.c b/src/channel.c index d654dc06d3..1363ee9299 100644 --- a/src/channel.c +++ b/src/channel.c @@ -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 */ |