Commit f8f58fe3 authored by Alan Mackenzie's avatar Alan Mackenzie
Browse files

Mode line "%q" construct: Just use one number when both would be the same.

* src/xdisp (decode_mode_spec): recode the "%q" bit appropriately.
parent 90e8d651
...@@ -23992,21 +23992,18 @@ decode_mode_spec (struct window *w, register int c, int field_width, ...@@ -23992,21 +23992,18 @@ decode_mode_spec (struct window *w, register int c, int field_width,
ptrdiff_t botpos = BUF_Z (b) - w->window_end_pos; ptrdiff_t botpos = BUF_Z (b) - w->window_end_pos;
ptrdiff_t begv = BUF_BEGV (b); ptrdiff_t begv = BUF_BEGV (b);
ptrdiff_t zv = BUF_ZV (b); ptrdiff_t zv = BUF_ZV (b);
int top_perc, bot_perc;
   
if ((toppos <= begv) && (zv <= botpos)) if ((toppos <= begv) && (zv <= botpos))
return "All "; return "All ";
   
if (toppos <= begv) top_perc = toppos <= begv ? 0 : percent99 (toppos - begv, zv - begv);
strcpy (decode_mode_spec_buf, "0-"); bot_perc = zv <= botpos ? 100 : percent99 (botpos - begv, zv - begv);
else
sprintf (decode_mode_spec_buf, "%d-",
percent99 (toppos - begv, zv - begv));
   
if (zv <= botpos) if (top_perc == bot_perc)
strcat (decode_mode_spec_buf, "100%"); sprintf (decode_mode_spec_buf, "%d%%", top_perc);
else else
sprintf (&decode_mode_spec_buf [strlen (decode_mode_spec_buf)], sprintf (decode_mode_spec_buf, "%d-%d%%", top_perc, bot_perc);
"%d%%", percent99 (botpos - begv, zv - begv));
   
return decode_mode_spec_buf; return decode_mode_spec_buf;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment