summaryrefslogtreecommitdiff
path: root/src/buffer.c
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-12-11 09:48:25 +0000
committerRichard M. Stallman <rms@gnu.org>1994-12-11 09:48:25 +0000
commit8c07a7e02f98aae50e675b3927eb80a8a24bc4a4 (patch)
treec6dfb0b2eb4aa83844abbb9c2286805e3482bf8d /src/buffer.c
parent24d19f86aa85b450b3cabddc17f4006f0338303b (diff)
downloademacs-8c07a7e02f98aae50e675b3927eb80a8a24bc4a4.tar.gz
(list_buffers_1): Right-align the size values.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 26eefc3c986..4d4169c22ca 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1142,8 +1142,8 @@ list_buffers_1 (files)
desired_point = Qnil;
other_file_symbol = intern ("list-buffers-directory");
- XSETFASTINT (col1, 19);
- XSETFASTINT (col2, 26);
+ XSETFASTINT (col1, 17);
+ XSETFASTINT (col2, 28);
XSETFASTINT (col3, 40);
XSETFASTINT (minspace, 1);
@@ -1152,8 +1152,8 @@ list_buffers_1 (files)
current_buffer->read_only = Qnil;
write_string ("\
- MR Buffer Size Mode File\n\
- -- ------ ---- ---- ----\n", -1);
+ MR Buffer Size Mode File\n\
+ -- ------ ---- ---- ----\n", -1);
for (tail = Vbuffer_alist; !NILP (tail); tail = Fcdr (tail))
{
@@ -1177,9 +1177,27 @@ list_buffers_1 (files)
write_string ((b != current_buffer && NILP (b->read_only))
? " " : "% ", -1);
Fprinc (b->name, Qnil);
- Findent_to (col1, make_number (2));
- XSETFASTINT (tem, BUF_Z (b) - BUF_BEG (b));
- Fprin1 (tem, Qnil);
+ tem = Findent_to (col1, make_number (2));
+ {
+ char sizebuf[9];
+ int i;
+ char *p;
+
+ sprintf (sizebuf, "%8d", BUF_Z (b) - BUF_BEG (b));
+ /* Here's how many extra columns the buffer name used. */
+ i = XFASTINT (tem) - XFASTINT (col1);
+ /* Skip that many spaces in the size, if it has that many,
+ to keep the size values right-aligned if possible. */
+ p = sizebuf;
+ while (i > 0)
+ {
+ if (*p == ' ')
+ p++;
+ i--;
+ }
+
+ write_string (p, -1);
+ }
Findent_to (col2, minspace);
Fprinc (b->mode_name, Qnil);
Findent_to (col3, minspace);