lichray/nvi2

Cannot insert blank line after command separator

Opened this issue · 0 comments

This is a similar issue to #134, reproduced like so:

$ printf '%s\n' 'a|' . %p | nvi -e

This should print a newline. A potential fix:

--- a/ex/ex_append.c
+++ b/ex/ex_append.c
@@ -179,7 +179,9 @@ ex_aci(SCR *sp, EXCMD *cmdp, enum which cmd)
 		if (len != 0)
 			cmdp->save_cmd = t;
 		cmdp->save_cmdlen = len;
-	}
+	} else if ((cmdp->save_cmd[-1] == '\n' || cmdp->save_cmd[-1] == '|') &&
+	    db_append(sp, 1, lno++, NULL, 0))
+		return (1);
 
 	if (F_ISSET(sp, SC_EX_GLOBAL)) {
 		if ((sp->lno = lno) == 0 && db_exist(sp, 1))

EDIT: Updated the patch for this scenario too:

g/enum/i\
<newline>