]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1152: Patch v9.1.1151 causes problems v9.1.1152
authorJohn Marriott <basilisk@internode.on.net>
Wed, 26 Feb 2025 18:14:06 +0000 (19:14 +0100)
committerChristian Brabandt <cb@256bit.org>
Wed, 26 Feb 2025 18:14:06 +0000 (19:14 +0100)
Problem:  Patch v9.1.1151 causes problems
Solution: partially revert it (John Marriott)

closes: #16736

Signed-off-by: Christian Brabandt <cb@256bit.org>
src/getchar.c
src/proto/getchar.pro
src/register.c
src/version.c

index 3b4aad05768c6c69b1d57b727b679f9da7846f11..014e5759fe1b540662f2055e9d6b69d053eb6098 100644 (file)
@@ -88,8 +88,6 @@ static char_u noremapbuf_init[TYPELEN_INIT];  // initial typebuf.tb_noremap
 
 static size_t  last_recorded_len = 0;  // number of last recorded chars
 
-static size_t  last_get_recorded_len = 0;      // length of the string returned from the
-                                               // last call to get_recorded()
 static size_t  last_get_inserted_len = 0;      // length of the string returned from the
                                                // last call to get_inserted()
 
@@ -173,8 +171,9 @@ get_buffcont(
 get_recorded(void)
 {
     char_u     *p;
+    size_t     len;
 
-    p = get_buffcont(&recordbuff, TRUE, &last_get_recorded_len);
+    p = get_buffcont(&recordbuff, TRUE, &len);
     if (p == NULL)
        return NULL;
 
@@ -184,35 +183,22 @@ get_recorded(void)
      * Remove the characters that were added the last time, these must be the
      * (possibly mapped) characters that stopped the recording.
      */
-    if (last_get_recorded_len >= last_recorded_len)
+    if (len >= last_recorded_len)
     {
-       last_get_recorded_len -= last_recorded_len;
-       p[last_get_recorded_len] = NUL;
+       len -= last_recorded_len;
+       p[len] = NUL;
     }
 
     /*
      * When stopping recording from Insert mode with CTRL-O q, also remove the
      * CTRL-O.
      */
-    if (last_get_recorded_len > 0 && restart_edit != 0
-                                   && p[last_get_recorded_len - 1] == Ctrl_O)
-    {
-       --last_get_recorded_len;
-       p[last_get_recorded_len] = NUL;
-    }
+    if (len > 0 && restart_edit != 0 && p[len - 1] == Ctrl_O)
+       p[len - 1] = NUL;
 
     return (p);
 }
 
-/*
- * Return the length of string returned from the last call of get_recorded().
- */
-    size_t
-get_recorded_len(void)
-{
-    return last_get_recorded_len;
-}
-
 /*
  * Return the contents of the redo buffer as a single string.
  * K_SPECIAL and CSI in the returned string are escaped.
index d1d78a223a2cf1d3276fc488f6a502fd26573143..c1eb1abadd598c1651bc549ccfde0b2ac07666a0 100644 (file)
@@ -1,6 +1,5 @@
 /* getchar.c */
 char_u *get_recorded(void);
-size_t get_recorded_len(void);
 char_u *get_inserted(void);
 size_t get_inserted_len(void);
 int stuff_empty(void);
index 384c4d54fc3503867439da0c3ab04d19531c28a8..465bee3bed6c07c011801dd5dda4962ef8923a61 100644 (file)
@@ -28,7 +28,7 @@ static yankreg_T      *y_current;         // ptr to current yankreg
 static int             y_append;           // TRUE when appending
 static yankreg_T       *y_previous = NULL; // ptr to last written yankreg
 
-static int     stuff_yank(int, char_u *, size_t);
+static int     stuff_yank(int, char_u *);
 static void    put_reedit_in_typebuf(int silent);
 static int     put_in_typebuf(char_u *s, int esc, int colon, int silent);
 static int     yank_copy_line(struct block_def *bd, long y_idx, int exclude_trailing_space);
@@ -419,7 +419,7 @@ do_record(int c)
            old_y_previous = y_previous;
            old_y_current = y_current;
 
-           retval = stuff_yank(regname, p, get_recorded_len());
+           retval = stuff_yank(regname, p);
 
            y_previous = old_y_previous;
            y_current = old_y_current;
@@ -435,8 +435,10 @@ do_record(int c)
  * return FAIL for failure, OK otherwise
  */
     static int
-stuff_yank(int regname, char_u *p, size_t plen)
+stuff_yank(int regname, char_u *p)
 {
+    size_t  plen;
+
     // check for read-only register
     if (regname != 0 && !valid_yank_reg(regname, TRUE))
     {
@@ -449,6 +451,7 @@ stuff_yank(int regname, char_u *p, size_t plen)
        return OK;
     }
 
+    plen = STRLEN(p);
     get_yank_register(regname, TRUE);
     if (y_append && y_current->y_array != NULL)
     {
index 3456be54a934b0e1c714d783bf8d4d2008122df8..b4c50feae2602a76968f8a112da81d149fdaaca9 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1152,
 /**/
     1151,
 /**/