1
0
mirror of https://github.com/rfivet/uemacs.git synced 2024-12-18 15:26:23 -05:00

Fix: insert space when justifying paragraph and justification starts on a space.

This commit is contained in:
Renaud 2021-07-18 10:02:49 +08:00
parent a00f12b614
commit 8540adea9e

13
word.c
View File

@ -352,9 +352,8 @@ static int parafillnjustify( int f, int n, int justify_f) {
int wbufsize ; int wbufsize ;
int wordlen; /* length of current word */ int wordlen; /* length of current word */
int clength; /* position on line during fill */ int clength; /* position on line during fill */
// int i; /* index during word copy */
int eopflag; /* Are we at the End-Of-Paragraph? */ int eopflag; /* Are we at the End-Of-Paragraph? */
int firstflag; /* first word? (needs no space) */ int firstflag = TRUE ; /* first word? (needs no space) */
struct line *eopline; /* pointer to line just past EOP */ struct line *eopline; /* pointer to line just past EOP */
int dotflag = 0 ; /* was the last char a period? */ int dotflag = 0 ; /* was the last char a period? */
int leftmarg = 0 ; /* left marginal */ int leftmarg = 0 ; /* left marginal */
@ -391,14 +390,20 @@ static int parafillnjustify( int f, int n, int justify_f) {
gotobop(FALSE, 1); gotobop(FALSE, 1);
/* initialize various info */ /* initialize various info */
if( justflag && leftmarg < llength(curwp->w_dotp)) if( justflag && leftmarg < llength(curwp->w_dotp)) {
setccol( leftmarg) ; setccol( leftmarg) ;
lgetchar( &c) ;
if( c == ' ' || c == '\t')
/* on a space */
if( getccol( TRUE) < getccol( FALSE))
/* first non space before current position */
firstflag = FALSE ;
}
clength = getccol( FALSE) ; clength = getccol( FALSE) ;
wordlen = 0; wordlen = 0;
/* scan through lines, filling words */ /* scan through lines, filling words */
firstflag = TRUE;
eopflag = FALSE; eopflag = FALSE;
while (!eopflag) { while (!eopflag) {
int bytes = 1; int bytes = 1;