Does not run input command by vi editor with vi mode.
I do the following:
1. set vi mode.
$ echo "bind -v" > ~/.editrc
2. launch /usr/bin/ftp command.
$ ftp
3. launch vi editor with ESC + v.
ftp> ESC + v
4. input "help" in vi editor.
i + help + ESC + :wq
5. then 'help' command does not run.
I fix this problem with following patch. This fix is come from NetBSD
lib/libedit/vi.c 1.46 and 1.47.
ok?
Index: vi.c
===================================================================
RCS file: /cvs/src/lib/libedit/vi.c,v
retrieving revision 1.27
diff -u -p -r1.27 vi.c
--- vi.c 3 Sep 2019 02:28:25 -0000 1.27
+++ vi.c 3 Sep 2019 05:34:31 -0000
@@ -1058,12 +1058,12 @@ vi_histedit(EditLine *el, wint_t c __att
while (waitpid(pid, &status, 0) != pid)
continue;
lseek(fd, (off_t)0, SEEK_SET);
- st = read(fd, cp, TMP_BUFSIZ);
+ st = read(fd, cp, TMP_BUFSIZ - 1);
if (st > 0) {
- len = (size_t)(el->el_line.lastchar -
- el->el_line.buffer);
+ cp[st] = '\0';
+ len = (size_t)(el->el_line.limit - el->el_line.buffer);
len = mbstowcs(el->el_line.buffer, cp, len);
- if (len > 0 && el->el_line.buffer[len -1] == '\n')
+ if (len > 0 && el->el_line.buffer[len - 1] == '\n')
--len;
}
else
--
ASOU Masato