On 31 Aug 17:16, Uwe Werler wrote:
> Hi folks,
>
> I'm just wondering why there's a test for an empty line and args to start the
> editor for line editing. In bash one can start vi immediately with an empty
> line by ^v. Might be there's another reason I don't understand for this test?
>
>
> Index: bin/ksh/vi.c
> ===================================================================
> RCS file: /cvs/src/bin/ksh/vi.c,v
> retrieving revision 1.60
> diff -u -p -u -r1.60 vi.c
> --- bin/ksh/vi.c 12 Mar 2021 02:10:25 -0000 1.60
> +++ bin/ksh/vi.c 31 Aug 2022 14:48:37 -0000
> @@ -964,8 +964,6 @@ vi_cmd(int argcnt, const char *cmd)
> break;
>
> case 'v':
> - if (es->linelen == 0 && argcnt == 0)
> - return -1;
> if (!argcnt) {
> if (modified) {
> es->cbuf[es->linelen] = '\0';
>
> --
>
> Uwe
>
Ping
Index: vi.c
=================================================================== RCS file:
/cvs/src/bin/ksh/vi.c,v retrieving revision 1.60 diff -u -p -r1.60 vi.c ---
vi.c 12 Mar 2021 02:10:25 -0000 1.60 +++ vi.c 19 Oct 2022 07:05:04
-0000 @@ -964,8 +964,6 @@ vi_cmd(int argcnt, const char *cmd) break;
case 'v':
- if (es->linelen == 0 && argcnt == 0)
- return -1;
if (!argcnt) {
if (modified) {
es->cbuf[es->linelen] = '\0';
--
wq: ~uw