Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot insert blank line after command separator #135

Open
mohd-akram opened this issue Jul 12, 2024 · 0 comments
Open

Cannot insert blank line after command separator #135

mohd-akram opened this issue Jul 12, 2024 · 0 comments

Comments

@mohd-akram
Copy link
Contributor

mohd-akram commented Jul 12, 2024

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant