Mercurial > vim
comparison src/os_unix.c @ 19405:08f4dc2ba716 v8.2.0260
patch 8.2.0260: several lines of code are duplicated
Commit: https://github.com/vim/vim/commit/f4140488c72cad4dbf5449dba099cfa7de7bbb22
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Feb 15 23:06:45 2020 +0100
patch 8.2.0260: several lines of code are duplicated
Problem: Several lines of code are duplicated.
Solution: Move duplicated code to a function. (Yegappan Lakshmanan,
closes #5330)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 15 Feb 2020 23:15:04 +0100 |
parents | 2ef19eed524a |
children | 22f0dda71638 |
comparison
equal
deleted
inserted
replaced
19404:7be3663e2f2b | 19405:08f4dc2ba716 |
---|---|
4978 close(toshell_fd); | 4978 close(toshell_fd); |
4979 toshell_fd = -1; | 4979 toshell_fd = -1; |
4980 } | 4980 } |
4981 } | 4981 } |
4982 | 4982 |
4983 // replace K_BS by <BS> and K_DEL by <DEL> | 4983 term_replace_bs_del_keycode(ta_buf, ta_len, len); |
4984 for (i = ta_len; i < ta_len + len; ++i) | |
4985 { | |
4986 if (ta_buf[i] == CSI && len - i > 2) | |
4987 { | |
4988 c = TERMCAP2KEY(ta_buf[i + 1], ta_buf[i + 2]); | |
4989 if (c == K_DEL || c == K_KDEL || c == K_BS) | |
4990 { | |
4991 mch_memmove(ta_buf + i + 1, ta_buf + i + 3, | |
4992 (size_t)(len - i - 2)); | |
4993 if (c == K_DEL || c == K_KDEL) | |
4994 ta_buf[i] = DEL; | |
4995 else | |
4996 ta_buf[i] = Ctrl_H; | |
4997 len -= 2; | |
4998 } | |
4999 } | |
5000 else if (ta_buf[i] == '\r') | |
5001 ta_buf[i] = '\n'; | |
5002 if (has_mbyte) | |
5003 i += (*mb_ptr2len_len)(ta_buf + i, | |
5004 ta_len + len - i) - 1; | |
5005 } | |
5006 | 4984 |
5007 /* | 4985 /* |
5008 * For pipes: echo the typed characters. | 4986 * For pipes: echo the typed characters. |
5009 * For a pty this does not seem to work. | 4987 * For a pty this does not seem to work. |
5010 */ | 4988 */ |