]> granicus.if.org Git - vim/commitdiff
patch 8.2.5076: unnecessary code v8.2.5076
authorzeertzjq <zeertzjq@outlook.com>
Fri, 10 Jun 2022 14:30:32 +0000 (15:30 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 10 Jun 2022 14:30:32 +0000 (15:30 +0100)
Problem:    Unnecessary code.
Solution:   Remove code and replace with function call. (closes #10552)

src/drawline.c
src/getchar.c
src/version.c

index 59c62c79d378049bf41b59cbfb29a956e681dd28..51a5fbfab04414d4ad9e1ec95cc18b507df35df7 100644 (file)
@@ -2116,14 +2116,15 @@ win_line(
                        mb_utf8 = FALSE;
                }
 
-               if ((trailcol != MAXCOL && ptr > line + trailcol && c == ' ')
-                       || (leadcol != 0 && ptr < line + leadcol && c == ' '))
+               if (c == ' ' && ((trailcol != MAXCOL && ptr > line + trailcol)
+                                   || (leadcol != 0 && ptr < line + leadcol)))
                {
                    if (leadcol != 0 && in_multispace && ptr < line + leadcol
                            && wp->w_lcs_chars.leadmultispace != NULL)
                    {
                        c = wp->w_lcs_chars.leadmultispace[multispace_pos++];
-                       if (wp->w_lcs_chars.leadmultispace[multispace_pos] == NUL)
+                       if (wp->w_lcs_chars.leadmultispace[multispace_pos]
+                                                                       == NUL)
                            multispace_pos = 0;
                    }
 
@@ -2133,7 +2134,7 @@ win_line(
                    else if (ptr < line + leadcol && wp->w_lcs_chars.lead)
                        c = wp->w_lcs_chars.lead;
 
-                   else if (leadcol != 0 && c == ' ' && wp->w_lcs_chars.space)
+                   else if (leadcol != 0 && wp->w_lcs_chars.space)
                        c = wp->w_lcs_chars.space;
 
 
index 2747423b1d787a971812bd849376f7dc83f53f40..210a67acad597f1f7aab63a66aa5474c529e392a 100644 (file)
@@ -1115,33 +1115,12 @@ ins_typebuf(
  * Returns the length of what was inserted.
  */
     int
-ins_char_typebuf(int c, int modifier)
+ins_char_typebuf(int c, int modifiers)
 {
     char_u     buf[MB_MAXBYTES * 3 + 4];
-    int                len = 0;
+    int                len = special_to_buf(c, modifiers, TRUE, buf);
 
-    if (modifier != 0)
-    {
-       buf[0] = K_SPECIAL;
-       buf[1] = KS_MODIFIER;
-       buf[2] = modifier;
-       buf[3] = NUL;
-       len = 3;
-    }
-    if (IS_SPECIAL(c))
-    {
-       buf[len] = K_SPECIAL;
-       buf[len + 1] = K_SECOND(c);
-       buf[len + 2] = K_THIRD(c);
-       buf[len + 3] = NUL;
-       len += 3;
-    }
-    else
-    {
-       char_u *end = add_char2buf(c, buf + len);
-       *end = NUL;
-       len = end - buf;
-    }
+    buf[len] = NUL;
     (void)ins_typebuf(buf, KeyNoremap, 0, !KeyTyped, cmd_silent);
     return len;
 }
index d86a23d5647385e5d192318a1ac46848c67e4fe3..091cdbac086dd25f615402385648ce29233e3d00 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    5076,
 /**/
     5075,
 /**/