diff options
| author | Richard M. Stallman | 1994-02-11 18:56:15 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-02-11 18:56:15 +0000 |
| commit | 8ffcb79f954c5453384ebc127c24492372e57c58 (patch) | |
| tree | 1dff22ab3767ce56f1b4d2a915f20f84ad9eeafc /src | |
| parent | e7e0c779e1b0761ee89fd3f6bae93b3cfbca0949 (diff) | |
| download | emacs-8ffcb79f954c5453384ebc127c24492372e57c58.tar.gz emacs-8ffcb79f954c5453384ebc127c24492372e57c58.zip | |
(decode_mode_spec): Implement `P'.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 29 |
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) | |||
| 2885 | } | 2885 | } |
| 2886 | } | 2886 | } |
| 2887 | 2887 | ||
| 2888 | /* Display percentage of size above the bottom of the screen. */ | ||
| 2889 | case 'P': | ||
| 2890 | { | ||
| 2891 | int toppos = marker_position (w->start); | ||
| 2892 | int botpos = Z - XFASTINT (w->window_end_pos); | ||
| 2893 | int total = ZV - BEGV; | ||
| 2894 | |||
| 2895 | if (botpos >= ZV) | ||
| 2896 | { | ||
| 2897 | if (toppos <= BEGV) | ||
| 2898 | return "All"; | ||
| 2899 | else | ||
| 2900 | return "Bottom"; | ||
| 2901 | } | ||
| 2902 | else | ||
| 2903 | { | ||
| 2904 | total = ((botpos - BEGV) * 100 + total - 1) / total; | ||
| 2905 | /* We can't normally display a 3-digit number, | ||
| 2906 | so get us a 2-digit number that is close. */ | ||
| 2907 | if (total == 100) | ||
| 2908 | total = 99; | ||
| 2909 | if (toppos <= BEGV) | ||
| 2910 | sprintf (decode_mode_spec_buf, "Top%2d%%", total); | ||
| 2911 | else | ||
| 2912 | sprintf (decode_mode_spec_buf, "%2d%%", total); | ||
| 2913 | return decode_mode_spec_buf; | ||
| 2914 | } | ||
| 2915 | } | ||
| 2916 | |||
| 2888 | case '%': | 2917 | case '%': |
| 2889 | return "%"; | 2918 | return "%"; |
| 2890 | 2919 | ||