Bug 282734 - top(1) manpage lists ^L as refresh command, but SPC is the actual command
Summary: top(1) manpage lists ^L as refresh command, but SPC is the actual command
Status: In Progress
Alias: None
Product: Documentation
Classification: Unclassified
Component: Manual Pages (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Alexander Ziaee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-13 20:30 UTC by Wes
Modified: 2025-03-25 21:56 UTC (History)
6 users (show)

See Also:


Attachments
Change the man page to show SPC as the refresh key rather than ^L (416 bytes, patch)
2024-11-16 18:25 UTC, Wes
ellisgen: maintainer-approval+
Details | Diff
patch to top.1 (440 bytes, patch)
2025-02-26 03:36 UTC, Mark Linimon
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wes 2024-11-13 20:30:06 UTC
The manual page states the following in the INTERACTIVE MODE section:
---
These commands are currently recognized (^L refers to control-L):

       ^L      Redraw the screen.
---

I don't think this is correct. When I attempt control + L the program responds with an unrecognized command message.

Reading through the source and the help within the program, it appears that ^L was replaced with SPC at some point in the past. If this is the case, the man page could be updated like so:

---
These commands are currently recognized:

       SPC      Redraw the screen.
---
Comment 1 Wes 2024-11-16 18:25:45 UTC
Created attachment 255222 [details]
Change the man page to show SPC as the refresh key rather than ^L

This is a diff created of the change to the top.1 file to replace ^L with SPC and remove references to ^L.
Comment 2 Alexander Ziaee freebsd_triage 2024-11-17 05:01:21 UTC
Confirmed. Having trouble finding the specific commit though.
Comment 3 Kai Burghardt 2025-01-06 10:48:27 UTC
(In reply to Wes from comment #1)

Please write something like "(space bar)". The string "SPC" appears to
be an acronym, i.e. three words beginning with the letters S, P, and C
respectively. This is very confusing.

(And I know `top(1)`'s online help (key `h` or `?`) shows "SPC", too.)


(In reply to Alexander Ziaee from comment #2)

Commit c8aa5e526fc02c360b09718a7dcb5db1876dca05 removes the mapping
of `\f` (form feed) to `CMD_redraw` (see `command_chars`). Commit
b26cf3d06cf3eb014c93aef569748e60feae1911 does not associate any char
with `CMD_redraw` (in `all_commands`).

Eventually commit c8aa5e526fc02c360b09718a7dcb5db1876dca05 introduces
the line `{' ', "update the display", false, CMD_update},` but this
is actually the update command.

If I do something like `printf '\f' > /dev/ttyv1` (where `ttyv1` runs
an instance of `top(1)`) I do not observe any change (except the
cursor moving one box down till the next refresh).
Comment 4 Mark Linimon freebsd_committer freebsd_triage 2025-02-26 03:36:38 UTC
Created attachment 257972 [details]
patch to top.1

^Triage: rebase patch.
Comment 5 Alexander Ziaee freebsd_triage 2025-03-23 07:08:56 UTC
May I commit this?
Comment 6 Jamie Landeg-Jones 2025-03-23 16:53:28 UTC
As noted above by Kai, "space" doesn't redraw the screen, it just does an update.

If from another window you write loads of text into the window running "top" then the corruptions will stay there even if you press "space".

Again, as with Kai, I dislike the use of "SPC"
Comment 7 Alexander Ziaee freebsd_triage 2025-03-23 17:53:15 UTC
Ok, ascii(7) actually calls it SP, but I think I'm going to call it `space`. Objections?
Comment 8 Alexander Ziaee freebsd_triage 2025-03-23 17:55:04 UTC
I am now convinced of the need to put ASCII(7) in intro(5).
Comment 9 Alexander Ziaee freebsd_triage 2025-03-23 18:39:11 UTC
I wrote a patch, please review.

https://reviews.freebsd.org/D49462
Comment 10 Jamie Landeg-Jones 2025-03-24 20:08:28 UTC
(In reply to Alexander Ziaee from comment #7)

Looks good to me.

As for ascii(7), that's a man page I used to find very useful in the past, so I think any in-context mentions of it would be handy. I can't comment on intro(5) one way or the other, but I note it's very sparse!
Comment 11 Alexander Ziaee freebsd_triage 2025-03-24 20:30:52 UTC
(In reply to Jamie Landeg-Jones from comment #10)

I have it rendered in PDF and a link to the review on https://people.freebsd.org/~ziaee
Comment 12 commit-hook freebsd_committer freebsd_triage 2025-03-25 21:56:32 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=0a85254d5a33800600477ce57fbaab64591aa6ea

commit 0a85254d5a33800600477ce57fbaab64591aa6ea
Author:     Alexander Ziaee <ziaee@FreeBSD.org>
AuthorDate: 2025-03-23 18:28:53 +0000
Commit:     Alexander Ziaee <ziaee@FreeBSD.org>
CommitDate: 2025-03-25 21:51:08 +0000

    top: Polish key bindings in usage and manual

    Organize key bindings by ascii(7) for consistency and maintainability,
    mark them as Interactive Commands, wordsmith them, and sync their
    organization between the manual and help screen.

    MFC after:              3 days
    PR:                     282734
    Fixes:                  c8aa5e526 (move command mapping to commands.c)
    Reviewed by:            imp, mhorne, Jim Brown <jpb@jimby.name>
    Approved by:            mhorne (mentor)
    Differential Revision:  https://reviews.freebsd.org/D49462

 usr.bin/top/commands.c |  26 +++----
 usr.bin/top/top.1      | 183 +++++++++++++++++++++++++------------------------
 2 files changed, 105 insertions(+), 104 deletions(-)