diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-02-15 23:06:45 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-02-15 23:06:45 +0100 |
commit | f4140488c72cad4dbf5449dba099cfa7de7bbb22 (patch) | |
tree | ef69c7720d31e0871cd01c41d447a5440e9d8e9c /src/os_unix.c | |
parent | ebdf3c964a901fc00c9009689f7cfda478342c51 (diff) | |
download | vim-git-f4140488c72cad4dbf5449dba099cfa7de7bbb22.tar.gz |
patch 8.2.0260: several lines of code are duplicatedv8.2.0260
Problem: Several lines of code are duplicated.
Solution: Move duplicated code to a function. (Yegappan Lakshmanan,
closes #5330)
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index 15d88f9e1..654480d9e 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -4980,29 +4980,7 @@ mch_call_shell_fork( } } - // replace K_BS by <BS> and K_DEL by <DEL> - for (i = ta_len; i < ta_len + len; ++i) - { - if (ta_buf[i] == CSI && len - i > 2) - { - c = TERMCAP2KEY(ta_buf[i + 1], ta_buf[i + 2]); - if (c == K_DEL || c == K_KDEL || c == K_BS) - { - mch_memmove(ta_buf + i + 1, ta_buf + i + 3, - (size_t)(len - i - 2)); - if (c == K_DEL || c == K_KDEL) - ta_buf[i] = DEL; - else - ta_buf[i] = Ctrl_H; - len -= 2; - } - } - else if (ta_buf[i] == '\r') - ta_buf[i] = '\n'; - if (has_mbyte) - i += (*mb_ptr2len_len)(ta_buf + i, - ta_len + len - i) - 1; - } + term_replace_bs_del_keycode(ta_buf, ta_len, len); /* * For pipes: echo the typed characters. |