buffer-position (CTL-X =) reports 100% ratio when at end of file even for empty buffer.

This commit is contained in:
Renaud 2020-05-10 12:07:08 +08:00
parent 3807410154
commit 659ada8b64
1 changed files with 2 additions and 3 deletions

View File

@ -112,9 +112,8 @@ int showcpos(int f, int n)
ecol = getccol(FALSE);
curwp->w_doto = savepos;
ratio = 0; /* Ratio before dot. */
if (numchars != 0)
ratio = (100L * predchars) / numchars;
/* Ratio before dot. */
ratio = (numchars == 0) ? 100 : (100L * predchars) / numchars ;
/* summarize and report the info */
char fmtbuf[] = "Line %d/%d Col %d/%d Char %D/%D (%d%%) char = %s%x" ;