From 81b85876add936231a832044e0e2f9d7efa3808d Mon Sep 17 00:00:00 2001
From: Bram Moolenaar <Bram@vim.org>
Date: Sun, 4 Mar 2007 20:22:01 +0000
Subject: [PATCH] updated for version 7.0-207

---
 src/getchar.c         | 29 +++++++++++++++++++++++++++++
 src/ops.c             |  3 +++
 src/proto/getchar.pro |  1 +
 src/version.c         |  2 ++
 4 files changed, 35 insertions(+)

diff --git a/src/getchar.c b/src/getchar.c
index 9d8944cb87..447805e0f5 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -4440,6 +4440,35 @@ vim_strsave_escape_csi(p)
     return res;
 }
 
+/*
+ * Remove escaping from CSI and K_SPECIAL characters.  Reverse of
+ * vim_strsave_escape_csi().  Works in-place.
+ */
+    void
+vim_unescape_csi(p)
+    char_u *p;
+{
+    char_u	*s = p, *d = p;
+
+    while (*s != NUL)
+    {
+	if (s[0] == K_SPECIAL && s[1] == KS_SPECIAL && s[2] == KE_FILLER)
+	{
+	    *d++ = K_SPECIAL;
+	    s += 3;
+	}
+	else if ((s[0] == K_SPECIAL || s[0] == CSI)
+				   && s[1] == KS_EXTRA && s[2] == (int)KE_CSI)
+	{
+	    *d++ = CSI;
+	    s += 3;
+	}
+	else
+	    *d++ = *s++;
+    }
+    *d = NUL;
+}
+
 /*
  * Write map commands for the current mappings to an .exrc file.
  * Return FAIL on error, OK otherwise.
diff --git a/src/ops.c b/src/ops.c
index 701b3393b0..3fe69fc75e 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -1042,6 +1042,9 @@ do_record(c)
 	    retval = FAIL;
 	else
 	{
+	    /* Remove escaping for CSI and K_SPECIAL in multi-byte chars. */
+	    vim_unescape_csi(p);
+
 	    /*
 	     * We don't want to change the default register here, so save and
 	     * restore the current register name.
diff --git a/src/proto/getchar.pro b/src/proto/getchar.pro
index b1f02fa08f..fe6f3fb2da 100644
--- a/src/proto/getchar.pro
+++ b/src/proto/getchar.pro
@@ -56,6 +56,7 @@ extern char_u *set_context_in_map_cmd __ARGS((expand_T *xp, char_u *cmd, char_u
 extern int ExpandMappings __ARGS((regmatch_T *regmatch, int *num_file, char_u ***file));
 extern int check_abbr __ARGS((int c, char_u *ptr, int col, int mincol));
 extern char_u *vim_strsave_escape_csi __ARGS((char_u *p));
+extern void vim_unescape_csi __ARGS((char_u *p));
 extern int makemap __ARGS((FILE *fd, buf_T *buf));
 extern int put_escstr __ARGS((FILE *fd, char_u *strstart, int what));
 extern void check_map_keycodes __ARGS((void));
diff --git a/src/version.c b/src/version.c
index caffda0fbd..ef0923f8a5 100644
--- a/src/version.c
+++ b/src/version.c
@@ -666,6 +666,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    207,
 /**/
     206,
 /**/
-- 
GitLab