summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2023-02-20 18:44:33 +0000
committerBram Moolenaar <Bram@vim.org>2023-02-20 18:44:33 +0000
commit6b066c6d8f57aa05f1ab29ab4d098bc4bfabb1bb (patch)
tree2383b2ef39f661b1922386df6994758f7b683c0b
parentb444ee761a2956a996a75d923281c51fa1a759f3 (diff)
patch 9.0.1333: when redo'ing twice <ScriptCmd> may not get the script IDv9.0.1333
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)
-rw-r--r--src/getchar.c19
-rw-r--r--src/version.c2
2 files changed, 15 insertions, 6 deletions
diff --git a/src/getchar.c b/src/getchar.c
index 2f0079d5cf..6645be8a0e 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -3974,23 +3974,30 @@ getcmdkeycmd(
#if defined(FEAT_EVAL) || defined(PROTO)
/*
- * If there was a mapping put info about it in the redo buffer, so that "."
- * will use the same script context. We only need the SID.
+ * If there was a mapping we get its SID. Otherwise, use "last_used_sid", it
+ * is set when redo'ing.
+ * Put this SID in the redo buffer, so that "." will use the same script
+ * context.
*/
void
may_add_last_used_map_to_redobuff(void)
{
- char_u buf[3 + 20];
+ char_u buf[3 + 20];
+ int sid = -1;
- if (last_used_map == NULL || last_used_map->m_script_ctx.sc_sid < 0)
+ if (last_used_map != NULL)
+ sid = last_used_map->m_script_ctx.sc_sid;
+ if (sid < 0)
+ sid = last_used_sid;
+
+ if (sid < 0)
return;
// <K_SID>{nr};
buf[0] = K_SPECIAL;
buf[1] = KS_EXTRA;
buf[2] = KE_SID;
- vim_snprintf((char *)buf + 3, 20, "%d;",
- last_used_map->m_script_ctx.sc_sid);
+ vim_snprintf((char *)buf + 3, 20, "%d;", sid);
add_buff(&redobuff, buf, -1L);
}
#endif
diff --git a/src/version.c b/src/version.c
index 0095489c7e..b7fd23fa6a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1333,
+/**/
1332,
/**/
1331,