summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-02-11 18:56:15 +0000
committerRichard M. Stallman <rms@gnu.org>1994-02-11 18:56:15 +0000
commit8ffcb79f954c5453384ebc127c24492372e57c58 (patch)
tree1dff22ab3767ce56f1b4d2a915f20f84ad9eeafc
parente7e0c779e1b0761ee89fd3f6bae93b3cfbca0949 (diff)
downloademacs-8ffcb79f954c5453384ebc127c24492372e57c58.tar.gz
(decode_mode_spec): Implement `P'.
-rw-r--r--src/xdisp.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 24120fd83bb..92a9b6fba49 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2885,6 +2885,35 @@ decode_mode_spec (w, c, maxwidth)
}
}
+ /* 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 "%";