Mercurial > vim
comparison src/getchar.c @ 27156:67194006cad8 v8.2.4107
patch 8.2.4107: script context not restored after using <ScriptCmd>
Commit: https://github.com/vim/vim/commit/a9725221ac4650b7e9219bf6e3682826fe2e0096
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 16 13:30:33 2022 +0000
patch 8.2.4107: script context not restored after using <ScriptCmd>
Problem: Script context not restored after using <ScriptCmd>.
Solution: Also restore context when not in a script. (closes https://github.com/vim/vim/issues/9536)
Add the 'c' flag to feedkeys() to be able to test this.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 16 Jan 2022 14:45:03 +0100 |
parents | 54f0a6a9db2d |
children | bd072d44eb2c |
comparison
equal
deleted
inserted
replaced
27155:1ebb45dd9232 | 27156:67194006cad8 |
---|---|
3795 get_special_key_name(c1, cmod)); | 3795 get_special_key_name(c1, cmod)); |
3796 aborted = TRUE; | 3796 aborted = TRUE; |
3797 } | 3797 } |
3798 } | 3798 } |
3799 else | 3799 else |
3800 ga_append(&line_ga, (char)c1); | 3800 ga_append(&line_ga, c1); |
3801 | 3801 |
3802 cmod = 0; | 3802 cmod = 0; |
3803 } | 3803 } |
3804 | 3804 |
3805 no_mapping--; | 3805 no_mapping--; |
3813 int | 3813 int |
3814 do_cmdkey_command(int key UNUSED, int flags) | 3814 do_cmdkey_command(int key UNUSED, int flags) |
3815 { | 3815 { |
3816 int res; | 3816 int res; |
3817 #ifdef FEAT_EVAL | 3817 #ifdef FEAT_EVAL |
3818 sctx_T save_current_sctx = {0, 0, 0, 0}; | 3818 sctx_T save_current_sctx = {-1, 0, 0, 0}; |
3819 | 3819 |
3820 if (key == K_SCRIPT_COMMAND && last_used_map != NULL) | 3820 if (key == K_SCRIPT_COMMAND && last_used_map != NULL) |
3821 { | 3821 { |
3822 save_current_sctx = current_sctx; | 3822 save_current_sctx = current_sctx; |
3823 current_sctx = last_used_map->m_script_ctx; | 3823 current_sctx = last_used_map->m_script_ctx; |
3825 #endif | 3825 #endif |
3826 | 3826 |
3827 res = do_cmdline(NULL, getcmdkeycmd, NULL, flags); | 3827 res = do_cmdline(NULL, getcmdkeycmd, NULL, flags); |
3828 | 3828 |
3829 #ifdef FEAT_EVAL | 3829 #ifdef FEAT_EVAL |
3830 if (save_current_sctx.sc_sid > 0) | 3830 if (save_current_sctx.sc_sid >= 0) |
3831 current_sctx = save_current_sctx; | 3831 current_sctx = save_current_sctx; |
3832 #endif | 3832 #endif |
3833 | 3833 |
3834 return res; | 3834 return res; |
3835 } | 3835 } |