Mercurial > vim
diff src/channel.c @ 14103:d053ec57d886 v8.1.0069
patch 8.1.0069: cannot handle pressing CTRL-C in a prompt buffer
commit https://github.com/vim/vim/commit/0e5979a6d491f68c4a8c86fab489016919329a6b
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 17 19:36:33 2018 +0200
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().
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 17 Jun 2018 19:45:06 +0200 |
parents | e271ca6f32f9 |
children | 3c80092eb211 |
line wrap: on
line diff
--- 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 */