summaryrefslogtreecommitdiffstats
path: root/src/getchar.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-06-10 15:30:32 +0100
committerBram Moolenaar <Bram@vim.org>2022-06-10 15:30:32 +0100
commit2e7cba347fc8b746add12aa5e0e9f6218a76c788 (patch)
tree8225458b3e9d5a108dd4c57f0e94e5aa736919fd /src/getchar.c
parentb74e04649168aec579183dfef70b8784d2afe993 (diff)
patch 8.2.5076: unnecessary codev8.2.5076
Problem: Unnecessary code. Solution: Remove code and replace with function call. (closes #10552)
Diffstat (limited to 'src/getchar.c')
-rw-r--r--src/getchar.c27
1 files changed, 3 insertions, 24 deletions
diff --git a/src/getchar.c b/src/getchar.c
index 2747423b1d..210a67acad 100644
--- 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;
+ 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;
}