From 3807410154900faaa6dfc6e23f94049af1c7a5f5 Mon Sep 17 00:00:00 2001 From: Renaud Fivet Date: Wed, 6 May 2020 16:27:40 +0800 Subject: [PATCH] buffer-position (CTL-X =) displays EOF as current character when at end of file. --- random.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/random.c b/random.c index e38e66a..c4517f7 100644 --- a/random.c +++ b/random.c @@ -102,9 +102,7 @@ int showcpos(int f, int n) if (curwp->w_dotp == curbp->b_linep) { predlines = numlines; predchars = numchars; -#if PKCODE - curchar = 0; -#endif + bytes = 0 ; } /* Get real column and end-of-line column. */ @@ -119,9 +117,12 @@ int showcpos(int f, int n) ratio = (100L * predchars) / numchars; /* summarize and report the info */ - mlwrite("Line %d/%d Col %d/%d Char %D/%D (%d%%) char = %s%x", - predlines + 1, numlines + 1, col, ecol, - predchars, numchars, ratio, (bytes > 1) ? "\\u" : "0x", curchar); + char fmtbuf[] = "Line %d/%d Col %d/%d Char %D/%D (%d%%) char = %s%x" ; + if( bytes == 0) + strcpy( &fmtbuf[ 39], "EOF") ; + + mlwrite( fmtbuf, predlines + 1, numlines + 1, col, ecol, predchars, + numchars, ratio, (bytes > 1) ? "\\u" : "0x", curchar) ; return TRUE; }