Mercurial > emacs
changeset 5903:0aea60a8c2d5
(decode_mode_spec): Implement `P'.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 11 Feb 1994 18:56:15 +0000 |
parents | 916cd5156aed |
children | 7f95b8e1ec44 |
files | src/xdisp.c |
diffstat | 1 files changed, 29 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xdisp.c Fri Feb 11 17:52:05 1994 +0000 +++ b/src/xdisp.c Fri Feb 11 18:56:15 1994 +0000 @@ -2885,6 +2885,35 @@ } } + /* Display percentage of size above the bottom of the screen. */ + case 'P': + { + int toppos = marker_position (w->start); + int botpos = Z - XFASTINT (w->window_end_pos); + int total = ZV - BEGV; + + if (botpos >= ZV) + { + if (toppos <= BEGV) + return "All"; + else + return "Bottom"; + } + else + { + total = ((botpos - BEGV) * 100 + total - 1) / total; + /* We can't normally display a 3-digit number, + so get us a 2-digit number that is close. */ + if (total == 100) + total = 99; + if (toppos <= BEGV) + sprintf (decode_mode_spec_buf, "Top%2d%%", total); + else + sprintf (decode_mode_spec_buf, "%2d%%", total); + return decode_mode_spec_buf; + } + } + case '%': return "%";