]> code.delx.au - gnu-emacs/commitdiff
(decode_mode_spec): Implement `P'.
authorRichard M. Stallman <rms@gnu.org>
Fri, 11 Feb 1994 18:56:15 +0000 (18:56 +0000)
committerRichard M. Stallman <rms@gnu.org>
Fri, 11 Feb 1994 18:56:15 +0000 (18:56 +0000)
src/xdisp.c

index 24120fd83bb4a41ed7ff14aca66e77560b12d689..92a9b6fba495e4a17d29fd5e4099504521272082 100644 (file)
@@ -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 "%";