rcom/research_notes/Иконки и помощь rcom/help_ux.md

28 KiB
Raw Permalink Blame History

Keyboard-only TUI help overlay for rcom

Category organization and choice of overall pattern

Takeaway

Use six keyboard-driven category tabs—Navigation, Selection, Files, Tasks, SSH, General—above one single-column command list. Tabs are preferable to another long document here because the existing narrow view already requires scrolling through 33 lines, while a complete inventory will be longer; a separate pane category is not worth a seventh tab.

Cited Findings

  • The current overlay mixes categories into two independently aligned columns at widths of 70 columns or more, calls itself HELP · yazi + mc, and combines unrelated commands with | on the same rows. Below that width it becomes one 33-line document. Current renderer; 40x8 snapshot
  • Selection and clipboard commands are real normal-mode commands (Space/Insert, v, Ctrl-a, I, U, y, x, p), but the current help has no Selection heading and omits several of these aliases/actions. Tasks, SSH, editor, undo, preview, panes, and general commands also have real, mode-specific input handlers. Normal-mode mapper; overlay handlers; task handler
  • The current specification explicitly asks for both key schemes and groups covering navigation, panes, file actions, editor, and connections; it also requires a readable overlay that does not change pane state. terminal-ui specification
  • Yazi's own quick-start documentation organizes its large command reference into Navigation, Selection, File operations, and Task manager sections, among others. This supports the proposed task-based taxonomy, but does not by itself establish anything about the appearance of Yazi's help overlay. Yazi quick start

Inferences

  • Recommended: category tabs plus one list. This gives every category a small, predictable working set, avoids split-column reading order, and degrades cleanly to a compact section switcher at 40 columns. The cost is that not every command is visible at once; clear section position, switching keys, and completeness tests are therefore mandatory.
  • Acceptable lightweight alternative: one continuous, single-column, sectioned document. It needs less state and fewer keys, and is preferable if minimizing implementation scope outweighs navigation speed. However, adding all currently omitted commands makes narrow-terminal browsing longer than the already-tested 33-line document. If chosen, add Home/End and section jumps rather than retaining the current dense rows.
  • Not recommended initially: searchable/filterable help. Incremental filtering adds text-entry modes and printable-key conflicts for a command set of only a few dozen actions. It can be a later enhancement, not a prerequisite for this redesign.
  • Not recommended: a category-menu screen followed by a detail screen. Enter/back navigation adds another mode without presenting more information than the compact tab switcher.
  • Not recommended as the sole help: context-sensitive help. It is useful as a supplement inside tasks or SSH, but a complete, stable reference must remain available regardless of the active pane or current error.

Recommended contents:

Tab Scope
Navigation Cursor movement, parent/open, first/last, full/half page, local home
Selection Toggle, visual mode, select all, invert, clear; keep clipboard operations out of this tab
Files Yank/cut/paste, copy/move to the other pane, create, rename, trash, permanent delete, undo, external editor
Tasks Open/close tasks, select, details, cancel, task scrolling
SSH Open host picker, filter/edit query, select/connect, close picker
General Active pane and single/dual layout, hidden files, refresh, preview, error details, help, close overlay/leave visual mode, quit

This keeps pane/layout commands in General rather than creating a sparsely populated seventh Panes tab. Use the title HELP only. On wide terminals, render a single tab strip such as [Navigation] Selection Files Tasks SSH General; below it, use one row per action with a key column and a description column. Those two columns are key → meaning, not two unrelated command columns.

Tab switching, scrolling, narrow terminals, and boundary behavior

Takeaway

Use horizontal keys exclusively for sections and vertical keys exclusively for scrolling: h/Left/Shift-Tab for previous section, l/Right/Tab for next; j/Down and k/Up for one line, with the existing page and half-page aliases. Wrap section navigation, clamp vertical scrolling, reset scroll on a section change, and replace the six-label strip with a full selected-section label at 40x8.

Cited Findings

  • Help currently accepts Esc/q to close, ?/F1 to toggle, F10 to quit, and delegates j/k, arrows, PageUp/PageDown, Ctrl-b/Ctrl-f, and Ctrl-u/Ctrl-d to overlay scrolling. Tab, arrows Left/Right, h, and l are currently unused by the help handler, so section switching can be added without stealing an existing help command. Help input handler; shared scroll mapping
  • Scroll deltas are stored with saturating addition in AppState.overlay_scroll; rendering separately clamps the effective offset to total - visible. Every overlay change resets the raw offset to zero. Reducer; overlay reset; render clamp
  • The runtime currently derives all overlay page steps from the active pane's visible entry rows, not from the help body. Event loop; dispatch by overlay; active-pane geometry
  • The minimum supported workspace is 40x8. At exactly 40x8, the bordered help has a 38-column inner width and currently five body rows plus a one-row footer. The accessibility test deliberately walks all 33 logical lines at 40x8 and 40x10. Layout constants; help geometry; minimum-size reachability test

Inferences

Interaction contract

Input Help behavior
h, Left, Shift-Tab Previous category; wrap last category after the first
l, Right, Tab Next category; wrap first category after the last
j, Down One rendered line down; clamp at bottom
k, Up One rendered line up; clamp at top
PageDown, Ctrl-f One actual help-body viewport down; clamp
PageUp, Ctrl-b One actual help-body viewport up; clamp
Ctrl-d / Ctrl-u Half a help-body viewport down/up; minimum one line; clamp
?, F1, Esc, q Close help without changing the workspace
F10 Preserve the existing application-quit behavior
  • Different navigation axes must not share behavior. Left/Right changes categories but never scrolls; Up/Down scrolls but never changes categories. Tab and Shift-Tab are additional horizontal aliases only while help is open; their normal workspace meaning remains unchanged.
  • Wrap categories, clamp content. Wrapping six categories makes Shift-Tab from Navigation useful and avoids a dead-end tab strip. Vertical wrap would unexpectedly jump from the end of a reference to its beginning, so vertical movement should stop at the boundaries.
  • Switching a category resets its scroll to zero. Reset on every section change and start at Navigation/offset zero on each fresh help opening. This is simpler and more predictable than six hidden offsets. Keep the state only for the lifetime of that help opening.
  • Do not execute commands from help. Enter should remain unbound in help; the reference is read-only and cannot accidentally mutate files.
  • Preserve Press/Repeat handling for scrolling and Press-only handling for destructive/global actions. Category switching may accept Press and Repeat for arrows/h/l, but Tab/Shift-Tab need only Press.

Responsive layout

  • On a wide strip, show all category names only if their measured display widths fit. The selected category must include a non-color marker such as [Navigation] (and optionally bold/reverse video).

  • When the complete strip does not fit, show one full label and position instead, for example < 1/6 Navigation > in ASCII mode or ‹ 1/6 Navigation › in Unicode mode. Do not reduce categories to unexplained initials and do not silently clip labels.

  • At 40x8 this costs one inner row, leaving four body rows plus the footer. A suitable ASCII footer is 1-4/11 | h/l Tabs | j/k Scroll | Esc (36 columns); wider layouts can additionally advertise arrows, Tab, paging, and ?/q.

  • Wrap a long description with a hanging indent aligned to the description column. Never truncate a key alias or the permanent-delete warning merely to preserve one physical row per command. Calculate scroll ranges after wrapping.

  • Suggested narrow shape (body contents scroll):

    ╭HELP──────────────────────────────────╮
    │< 1/6 Navigation                      >│
    │j / Down       Next entry             │
    │k / Up         Previous entry         │
    │h / Left       Parent directory       │
    │l / Right /…   Open directory         │
    │1-4/11 | h/l Tabs | j/k Scroll | Esc  │
    ╰──────────────────────────────────────╯
    

    The ellipsis above is illustrative only; the implementation should wrap that row so Enter is never lost.

  • Replace active-pane page sizing with help-specific geometry computed from the current terminal rectangle: page = body_height, half_page = max(body_height / 2, 1). The renderer and input path should use the same pure layout/view-model function.

  • Normalize the stored scroll offset to [0, max_scroll] on input and resize, rather than only clamping during rendering. Otherwise repeated PageDown can leave a large raw offset and subsequent k presses can appear stuck at the bottom. Keep the renderer's defensive clamp as well.

  • Below 40x8, retain the existing terminal-too-small behavior; supported-size help must never panic at empty or degenerate rectangles.

Showing every alias without product names or dense collisions

Takeaway

Describe aliases as equivalent keys for an action—j / Down, A / F7, u / Ctrl-z—without assigning them to another program. Use one action per row and explicit context labels for task/SSH/help behavior; do not squeeze unrelated actions onto a row with |.

Cited Findings

  • The authoritative normal-mode mapping shows that uppercase and lowercase keys are distinct (U clears selection while u undoes; I inverts selection while Ctrl-r refreshes), gg is a timed prefix, Insert aliases Space for selection, and both F-key and letter aliases coexist. Input mapper and prefix handling; normal bindings
  • Existing tests explicitly verify alias-to-command equivalence and the uppercase distinctions. Alias tests
  • The current renderer places selection and copy/move aliases in Navigation rows, concatenates preview and undo, and puts task details in an overloaded General row. This is a presentation problem, not a shortage of actual commands. Current help data
  • The host picker captures printable characters before global aliases, including j, q, r, s, ~, and ?; therefore its help must not imply that those letters perform normal-mode commands while filtering. Host picker input

Inferences

The following is the recommended complete content inventory, derived from the current mapper. Each cell lists all aliases for that row; labels are neutral descriptions, not keymap families.

Navigation

Keys Description
j / Down Next entry
k / Up Previous entry
h / Left Parent directory
l / Right / Enter Open directory
gg / Home First entry
G / End Last entry
Ctrl-b / PgUp Page up
Ctrl-f / PgDn Page down
Ctrl-u Half page up
Ctrl-d Half page down
~ Go to local home

Selection

Keys Description
Space / Insert Toggle selection and advance
v Toggle visual selection
Ctrl-a Select all visible entries
I Invert visible selection
U Clear selection

Files

Keys Description
y Yank/copy selection to clipboard
x Cut selection to clipboard
p Paste clipboard
F5 Copy selection to other pane
F6 Move selection to other pane
a Create file
A / F7 Create directory
r / F2 Rename hovered entry
d Trash selection (restorable)
D / F8 Permanently delete selection — NO UNDO
u / Ctrl-z Review/undo latest undoable action
e / F4 Edit regular file

Tasks (identify list versus details in descriptions or small subgroup labels)

Keys Description
t Open tasks; close task list when already open
j / Down Next task in task list
k / Up Previous task in task list
m / Enter Open task details
c Cancel selected task
Esc / m Back from task details
PgUp / PgDn, Ctrl-b / Ctrl-f, Ctrl-u / Ctrl-d Scroll task content

SSH (subheading “Host picker”)

Keys Description
s Choose SSH host (workspace)
Printable text Filter hosts; letters are entered literally
Backspace Delete filter character
Up / Down Previous/next host
Enter Connect selected host
Esc Close host picker

General

Keys Description
Tab / Shift-Tab Switch active pane (workspace)
\ Toggle single/dual pane
. Show/hide hidden files
Ctrl-r Refresh active listing
F3 Open preview; F3 / Esc / q closes preview
m Show active-pane error details, when available
? / F1 Open/close this help
Esc Close overlay; leave visual mode when no overlay is open
q / F10 Quit from workspace; within help, q closes help while F10 still quits

Presentation rules:

  • Preserve case literally and use consistent spellings: Ctrl-r, Shift-Tab, PgUp, PgDn, Space, Enter. Never collapse D into d or U into u.
  • Keep the dangerous distinction in words on the Files page: Trash (restorable) versus Permanently delete — NO UNDO.
  • A long alias set should wrap within the same action, not be split into misleading “primary” and “alternate” pages. At narrow widths, place the description on the next indented physical line if needed.
  • Help's own controls need not be repeated as fake workspace commands. The footer and General row should clearly distinguish “close help” from “quit application.”

Gaps

  • There is a pre-existing task-details inconsistency: its footer says j/k Scroll, but the input handler handles j/k as task selection before shared scrolling is reached. The help redesign should not claim a resolved details behavior until that conflict is fixed or explicitly specified. Task details footer; task input order

Discoverability after removing the permanent bottom hints

Takeaway

Remove the dedicated bottom hints row, but retain a small ? Help affordance in the existing header at every supported size. Keep contextual instructions inside empty/error states and overlays; do not replace the removed row with another permanent bottom row.

Cited Findings

  • The current permanent row is rendered only at heights of at least 10 and contains selection, clipboard, copy/move, tasks, help, and quit hints. Removing layout.hints releases one workspace row at those sizes. Hint allocation; hint renderer
  • The header already contains the product name/tagline on the left and mode on the right. Header renderer
  • The status row and empty-directory/listing-error states already provide state or contextual commands, while overlays generally retain their own local footer controls. Status renderer; empty/error messages; task overlay footer
  • At least one operation UI test finds t Tasks in the rendered whole frame rather than proving it is in the help body. Removing the hints row without adding Tasks to help would therefore reduce discoverability and break that test. Operation UI assertion

Inferences

  • Make the normal header right side responsive: wide layouts can show DUAL PANE 1/2 · ? Help; narrow layouts should first drop the dual-pane file manager subtitle and shorten mode text rather than dropping ? Help. ? Help is permanent, text-based, and requires no extra vertical space.
  • Do not steal space from critical status/error messages to squeeze all old hints into the status line. If a right-aligned help label is more consistent with the existing visual hierarchy, it can instead live in the status row, but the implementation must compact the left status deterministically and preserve errors; the header is the cleaner default.
  • Retain ? and F1 as the normal-mode entry points. Include both aliases in the General help page, README/manual if one exists, and any empty/error message where a short ? Help suffix fits naturally.
  • Keep overlay-local footers: they are contextual instructions, not the permanent workspace hint row being removed. The help overlay itself must always show section switching, scrolling, and closing.
  • Avoid first-run popups or timed tutorial messages as the primary discovery mechanism; they are not reliable on later launches and complicate deterministic state.

Gaps

  • No user research in the repository establishes whether users notice a header affordance more readily than a status affordance. The header recommendation follows from available space and the requirement to remove the bottom row; it should receive a simple 40x8 visual review.

Accessibility, completeness, implementation feasibility, and deterministic tests

Takeaway

Represent category and scroll as explicit state, render from a static section/action inventory, and make selected category and scroll position understandable in plain ASCII with no color. Extend the existing pure-renderer and input tests with full per-category reachability, boundary, resize, and alias-coverage tests rather than relying on snapshots alone.

Cited Findings

  • AppState currently stores only overlay and one shared overlay_scroll; Overlay::Help has no category state. Rendering takes &AppState and does not mutate it. State fields; overlay enum; render signature and Help dispatch
  • Existing rendering utilities already provide bordered/cleared overlays, bounded rectangles, sanitization, Unicode-aware fitting/wrapping, ASCII fallbacks, effective scroll ranges, and textual scroll positions. Help and utilities; text imports
  • The specification requires activity/focus to differ by more than color and requires NO_COLOR interfaces to remain structurally legible. Existing lists use both markers and style. Accessibility requirements; entry markers
  • Tests already use Ratatui TestBackend, compare application state before/after rendering, exercise keyboard reducers, collect all narrow frames, use Insta snapshots, and property-test multiple breakpoint sizes for panics. Overlay tests; accessibility tests; layout property test

Inferences

Feasible implementation shape

  • Add a small HelpCategory enum in a fixed six-item order and either AppState.help_category or a HelpState { category, scroll }. Add commands such as SelectHelpCategory(-1|1); reuse or refine ScrollOverlay for vertical deltas. set_overlay(Help) initializes category/offset, and category changes reset offset.
  • Keep a static HELP_SECTIONS inventory containing category, stable action ID, aliases, description, and context. A pure help_view_model(area, state) should produce the tab mode, wrapped display lines, body height, total, effective offset, and footer. Both input geometry and rendering can then agree without renderer mutation.
  • A future single binding table shared by input and help would eliminate drift, but a wholesale input refactor is not necessary for this visual redesign. If input remains a direct match, a test fixture must independently enumerate every normal binding and compare it with the help inventory.
  • Removing the hints field/renderer is straightforward but changes page geometry: current tests expecting 34 rows at 120x40, 18 at 80x24, and 4 at 40x10 will each increase by one when the hints row disappears. Update those expectations only after confirming the new frame geometry. Current page-size test

Minimum deterministic test matrix

  1. Content and naming: For every category, every required action and alias from the inventory appears. Across all categories and supported sizes, the help output contains neither yazi nor mc; its title is HELP. Trash and permanent delete remain textually distinct.
  2. Horizontal model: Left/h/Shift-Tab and Right/l/Tab produce the same previous/next transitions; Navigation-left wraps to General and General-right wraps to Navigation. Each transition resets scroll and leaves panes, selection, clipboard, mode, and locations unchanged.
  3. Vertical model: Test every existing scroll alias. Page and half-page steps use the help body's height at 40x8 and a wide size. Top/bottom clamp, and one k after many PageDown presses visibly leaves the bottom (catching raw-offset accumulation).
  4. Narrow completeness: At exactly 40x8, assert one compact full category label and four body rows. For each category, repeatedly page to the bottom, join frames, and assert every action and every alias is reachable, including wrapped lines and Enter in l / Right / Enter.
  5. Resize: Shrink and grow while on every category and at first/middle/last offsets. Assert clamped ranges, no missing final command, no panic, and no dependence on render order.
  6. Non-color/ASCII: Render Theme::no_color() and Theme::ascii(). The active category remains identifiable by brackets/marker and N/6; scroll range remains textual; no Nerd Font private-use glyph is required.
  7. Close/isolation: Esc, q, ?, and F1 close help; F10 retains quit behavior. Existing tests that file/planner/selection keys do not leak through help must remain. Closing help preserves the entire prior workspace.
  8. Discovery/layout: At all supported normal sizes the workspace contains ? Help and no old bottom-hints string or allocated hints row. Header text does not overlap. Update snapshots for wide help, 40x8 initial/scrolled help, and all affected main layouts.
  9. Property tests: Extend the existing width/height/overlay matrix with category and large-scroll values. Assert bounded output and no panic; use semantic reachability tests, not snapshots alone, to prove no command loss.

Gaps

  • This was a read-only investigation: no code was changed and no test suite was run. Exact wide breakpoints and wrapping snapshots should be derived with the implementation's Unicode-width utilities rather than guessed by character count.

Verifiable patterns from other keyboard TUIs

Takeaway

Borrow only two verified ideas: task-based documentation categories and a consistently available help command with list navigation. The cited Yazi and ranger sources do not verify a category-tab help overlay, so the proposed tabs are an rcom design choice rather than a claimed imitation.

Cited Findings

  • Yazi 26.9.1 documents F1/~ as help entry points and groups its quick-start command reference by tasks including Navigation, Selection, File operations, and Task manager. These keys are Yazi's own bindings and should not replace rcom's ?/F1. Yazi quick start
  • Yazi's keymap documentation defines a help layer with close, escape (clear filter or hide help), and arrow operations; arrow operations support top/bottom and separately named previous/next wraparound variants. Its shipped help keymap lists j/k, Up/Down, Ctrl-p/Ctrl-n, Esc/Ctrl-[, Ctrl-c, and Enter to close and run selected actions. Yazi help-layer documentation; Yazi shipped keymap
  • Ranger's source manual says ? opens its manual and describes access to lists of key bindings, commands, or settings. It separately documents settings for scroll wrapping and collapsing long key-hint submaps. Ranger manual source
  • Neither cited source provides enough evidence to claim particular tab visuals, category-switching keys, narrow-terminal behavior, or pagination behavior in Yazi's or ranger's help UI. The Yazi documentation verifies commands and operations, not the rendered layout. Yazi keymap documentation; Ranger manual source

Inferences

  • Adopt Yazi's useful information architecture (Navigation/Selection/Files/Tasks), not its product name, entry keys, or Enter-to-run behavior. Read-only help is safer and sufficient for rcom.
  • Yazi's distinction between ordinary clamped movement and explicitly named wraparound movement supports making boundary policy deliberate. For rcom, use wrap only for the six categories and clamp the document, as specified above.
  • Yazi's documented filter-aware help shows that filtering is a plausible later enhancement, but rcom need not reproduce it now. If filtering is ever added, Esc should first clear a nonempty filter and only then close help, with that state covered by tests.
  • Ranger demonstrates a manual accessible through one well-known key rather than dependence on a permanent row of every command. This supports retaining a visible ? Help entry point while moving exhaustive aliases into the overlay.
  • Do not cite either program in the redesigned UI. Neutral alias labels fully communicate rcom's behavior without attributing key families.

Gaps

  • Web search was unavailable during this investigation; external claims above were checked directly against current official Yazi documentation/shipped configuration and ranger's source manual. No visual behavior beyond those primary sources is asserted.