This is the current format of the output of the mg 'list-buffer'
command:

 MR Buffer                              Size   File
 -- ------                              ----   ----
    *Buffer List*                       0
.** file1.c                             6810   /tmp/file1.c
    file2.c                             7105   /tmp/file2.c
  * *scratch*                           0

The 'M' column indicates if the buffer is modified by having an
asterisk next to the buffer name. The 'R' column indicates if a buffer
is read-only by not having an asterisk in the 'R' column.  Therefor
the files above with an asterisk in the column next to them are
writable.  Isn't that unintuitive?

Also, perhaps less confusing than the 'R' column, is the first column
(note it doesn't have a header character), it has a '.' next to
'file1.c'. The '.' indicates that this is the active buffer in mg.
Could a different character indicate the active buffer? The diff below
makes the state of buffers above look like this:

 MR Buffer                              Size   File
 -- ------                              ----   ----
  * *Buffer List*                       0
*  file1.c                             6810   /tmp/file1.c
  * file2.c                             7105   /tmp/file2.c
    *scratch*                           0

Read-only buffers have an asterisk in the 'R' column and I'm using a
'>' character to indicate the active buffer. Is that better?

Also, since I had to check the code to see what 'R' meant (I guessed
'M'), and I didn't even notice the '.' character (I thought it was a dodgy
pixel), I have added a short explaination to the man page about the 3
columns.

Objectsions, oks?

Index: buffer.c
===================================================================
RCS file: /cvs/src/usr.bin/mg/buffer.c,v
retrieving revision 1.111
diff -u -p -r1.111 buffer.c
--- buffer.c    23 Mar 2021 18:40:29 -0000      1.111
+++ buffer.c    25 Mar 2021 15:08:36 -0000
@@ -368,9 +368,9 @@ makelist(void)
                }

                if (addlinef(blp, "%c%c%c %-*.*s%c%-6d %-*s",
-                   (bp == curbp) ? '.' : ' ',  /* current buffer ? */
+                   (bp == curbp) ? '>' : ' ',       /* current buffer ? */
                    ((bp->b_flag & BFCHG) != 0) ? '*' : ' ',     /* changed ? */
-                   ((bp->b_flag & BFREADONLY) != 0) ? ' ' : '*',
+                   ((bp->b_flag & BFREADONLY) != 0) ? '*' : ' ',
                    w - 5,              /* four chars already written */
                    w - 5,              /* four chars already written */
                    bp->b_bname,     /* buffer name */
Index: mg.1
===================================================================
RCS file: /cvs/src/usr.bin/mg/mg.1,v
retrieving revision 1.121
diff -u -p -r1.121 mg.1
--- mg.1        20 Mar 2021 09:00:49 -0000      1.121
+++ mg.1        25 Mar 2021 15:08:36 -0000
@@ -692,6 +692,11 @@ directory.
 Toggle whether the line number is displayed in the modeline.
 .It list-buffers
 Display the list of available buffers.
+The first column in the output indicates which buffer is active with a '>'
+character.
+The second column indicates which buffers are modified.
+The third column indicates which buffers are read-only.
+The remaining columns are self-explanatory.
 .It load
 Prompt the user for a filename, and then execute commands
 from that file.

Reply via email to