Mercurial > vim
comparison src/evalfunc.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 | c97e9edfc6b4 |
children | de75c249723d |
comparison
equal
deleted
inserted
replaced
14102:6919feb4b26e | 14103:d053ec57d886 |
---|---|
296 #endif | 296 #endif |
297 static void f_prevnonblank(typval_T *argvars, typval_T *rettv); | 297 static void f_prevnonblank(typval_T *argvars, typval_T *rettv); |
298 static void f_printf(typval_T *argvars, typval_T *rettv); | 298 static void f_printf(typval_T *argvars, typval_T *rettv); |
299 #ifdef FEAT_JOB_CHANNEL | 299 #ifdef FEAT_JOB_CHANNEL |
300 static void f_prompt_setcallback(typval_T *argvars, typval_T *rettv); | 300 static void f_prompt_setcallback(typval_T *argvars, typval_T *rettv); |
301 static void f_prompt_setinterrupt(typval_T *argvars, typval_T *rettv); | |
301 static void f_prompt_setprompt(typval_T *argvars, typval_T *rettv); | 302 static void f_prompt_setprompt(typval_T *argvars, typval_T *rettv); |
302 #endif | 303 #endif |
303 static void f_pumvisible(typval_T *argvars, typval_T *rettv); | 304 static void f_pumvisible(typval_T *argvars, typval_T *rettv); |
304 #ifdef FEAT_PYTHON3 | 305 #ifdef FEAT_PYTHON3 |
305 static void f_py3eval(typval_T *argvars, typval_T *rettv); | 306 static void f_py3eval(typval_T *argvars, typval_T *rettv); |
752 #endif | 753 #endif |
753 {"prevnonblank", 1, 1, f_prevnonblank}, | 754 {"prevnonblank", 1, 1, f_prevnonblank}, |
754 {"printf", 1, 19, f_printf}, | 755 {"printf", 1, 19, f_printf}, |
755 #ifdef FEAT_JOB_CHANNEL | 756 #ifdef FEAT_JOB_CHANNEL |
756 {"prompt_setcallback", 2, 2, f_prompt_setcallback}, | 757 {"prompt_setcallback", 2, 2, f_prompt_setcallback}, |
758 {"prompt_setinterrupt", 2, 2, f_prompt_setinterrupt}, | |
757 {"prompt_setprompt", 2, 2, f_prompt_setprompt}, | 759 {"prompt_setprompt", 2, 2, f_prompt_setprompt}, |
758 #endif | 760 #endif |
759 {"pumvisible", 0, 0, f_pumvisible}, | 761 {"pumvisible", 0, 0, f_pumvisible}, |
760 #ifdef FEAT_PYTHON3 | 762 #ifdef FEAT_PYTHON3 |
761 {"py3eval", 1, 1, f_py3eval}, | 763 {"py3eval", 1, 1, f_py3eval}, |
8620 buf->b_prompt_callback = callback; | 8622 buf->b_prompt_callback = callback; |
8621 buf->b_prompt_partial = partial; | 8623 buf->b_prompt_partial = partial; |
8622 } | 8624 } |
8623 | 8625 |
8624 /* | 8626 /* |
8627 * "prompt_setinterrupt({buffer}, {callback})" function | |
8628 */ | |
8629 static void | |
8630 f_prompt_setinterrupt(typval_T *argvars, typval_T *rettv UNUSED) | |
8631 { | |
8632 buf_T *buf; | |
8633 char_u *callback; | |
8634 partial_T *partial; | |
8635 | |
8636 if (check_secure()) | |
8637 return; | |
8638 buf = get_buf_tv(&argvars[0], FALSE); | |
8639 if (buf == NULL) | |
8640 return; | |
8641 | |
8642 callback = get_callback(&argvars[1], &partial); | |
8643 if (callback == NULL) | |
8644 return; | |
8645 | |
8646 free_callback(buf->b_prompt_interrupt, buf->b_prompt_int_partial); | |
8647 if (partial == NULL) | |
8648 buf->b_prompt_interrupt = vim_strsave(callback); | |
8649 else | |
8650 /* pointer into the partial */ | |
8651 buf->b_prompt_interrupt = callback; | |
8652 buf->b_prompt_int_partial = partial; | |
8653 } | |
8654 | |
8655 /* | |
8625 * "prompt_setprompt({buffer}, {text})" function | 8656 * "prompt_setprompt({buffer}, {text})" function |
8626 */ | 8657 */ |
8627 static void | 8658 static void |
8628 f_prompt_setprompt(typval_T *argvars, typval_T *rettv UNUSED) | 8659 f_prompt_setprompt(typval_T *argvars, typval_T *rettv UNUSED) |
8629 { | 8660 { |