Mercurial > vim
comparison src/getchar.c @ 32002:879456b2022b v9.0.1333
patch 9.0.1333: when redo'ing twice <ScriptCmd> may not get the script ID
Commit: https://github.com/vim/vim/commit/6b066c6d8f57aa05f1ab29ab4d098bc4bfabb1bb
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Feb 20 18:44:33 2023 +0000
patch 9.0.1333: when redo'ing twice <ScriptCmd> may not get the script ID
Problem: When redo'ing twice <ScriptCmd> may not get the script ID.
Solution: When "last_used_map" map is not set use "last_used_sid".
(closes #11930)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 20 Feb 2023 19:45:03 +0100 |
parents | 9fc3b3928ad5 |
children | a2dd770c854a |
comparison
equal
deleted
inserted
replaced
32001:c99521f92536 | 32002:879456b2022b |
---|---|
3972 return (char_u *)line_ga.ga_data; | 3972 return (char_u *)line_ga.ga_data; |
3973 } | 3973 } |
3974 | 3974 |
3975 #if defined(FEAT_EVAL) || defined(PROTO) | 3975 #if defined(FEAT_EVAL) || defined(PROTO) |
3976 /* | 3976 /* |
3977 * If there was a mapping put info about it in the redo buffer, so that "." | 3977 * If there was a mapping we get its SID. Otherwise, use "last_used_sid", it |
3978 * will use the same script context. We only need the SID. | 3978 * is set when redo'ing. |
3979 * Put this SID in the redo buffer, so that "." will use the same script | |
3980 * context. | |
3979 */ | 3981 */ |
3980 void | 3982 void |
3981 may_add_last_used_map_to_redobuff(void) | 3983 may_add_last_used_map_to_redobuff(void) |
3982 { | 3984 { |
3983 char_u buf[3 + 20]; | 3985 char_u buf[3 + 20]; |
3984 | 3986 int sid = -1; |
3985 if (last_used_map == NULL || last_used_map->m_script_ctx.sc_sid < 0) | 3987 |
3988 if (last_used_map != NULL) | |
3989 sid = last_used_map->m_script_ctx.sc_sid; | |
3990 if (sid < 0) | |
3991 sid = last_used_sid; | |
3992 | |
3993 if (sid < 0) | |
3986 return; | 3994 return; |
3987 | 3995 |
3988 // <K_SID>{nr}; | 3996 // <K_SID>{nr}; |
3989 buf[0] = K_SPECIAL; | 3997 buf[0] = K_SPECIAL; |
3990 buf[1] = KS_EXTRA; | 3998 buf[1] = KS_EXTRA; |
3991 buf[2] = KE_SID; | 3999 buf[2] = KE_SID; |
3992 vim_snprintf((char *)buf + 3, 20, "%d;", | 4000 vim_snprintf((char *)buf + 3, 20, "%d;", sid); |
3993 last_used_map->m_script_ctx.sc_sid); | |
3994 add_buff(&redobuff, buf, -1L); | 4001 add_buff(&redobuff, buf, -1L); |
3995 } | 4002 } |
3996 #endif | 4003 #endif |
3997 | 4004 |
3998 int | 4005 int |