From 3889f1709c531a7117712596f621c1f8b7688fb9 Mon Sep 17 00:00:00 2001 From: Renaud Fivet Date: Sun, 18 Jul 2021 11:15:18 +0800 Subject: [PATCH] Avoid inserting extra NL while doing fill/justify paragraph at EOF. --- word.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/word.c b/word.c index d9d1c81..adf4356 100644 --- a/word.c +++ b/word.c @@ -386,7 +386,7 @@ static int parafillnjustify( int f, int n, int justify_f) { gotoeop(FALSE, 1); eopline = lforw(curwp->w_dotp); - /* and back top the beginning of the paragraph */ + /* and back to the beginning of the paragraph */ gotobop(FALSE, 1); /* initialize various info */ @@ -463,8 +463,12 @@ static int parafillnjustify( int f, int n, int justify_f) { wordlen = 0; } } + /* and add a last newline for the end of our new paragraph */ - lnewline(); + if( eopline == curbp->b_linep) /* at EOF? */ + forwchar( FALSE, 1) ; + else + lnewline() ; if( justflag) { forwword(FALSE, 1);