# HG changeset patch # User Bram Moolenaar # Date 1654872303 -7200 # Node ID bfb2050956346d88baf861e021325c0457d99ec6 # Parent 7aef804534ffb8a59d2193a05c07894b785d651f patch 8.2.5076: unnecessary code Commit: https://github.com/vim/vim/commit/2e7cba347fc8b746add12aa5e0e9f6218a76c788 Author: zeertzjq Date: Fri Jun 10 15:30:32 2022 +0100 patch 8.2.5076: unnecessary code Problem: Unnecessary code. Solution: Remove code and replace with function call. (closes https://github.com/vim/vim/issues/10552) diff --git a/src/drawline.c b/src/drawline.c --- a/src/drawline.c +++ b/src/drawline.c @@ -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; diff --git a/src/getchar.c b/src/getchar.c --- a/src/getchar.c +++ b/src/getchar.c @@ -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; - - 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; - } + int len = special_to_buf(c, modifiers, TRUE, buf); + + buf[len] = NUL; (void)ins_typebuf(buf, KeyNoremap, 0, !KeyTyped, cmd_silent); return len; } diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -735,6 +735,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 5076, +/**/ 5075, /**/ 5074,