Files
glances/docs/superpowers
Claude ae8da4d397 WebUI v5: the TOGGLE VIEW hotkeys (1, j, 4, /)
Settles the question the SHOW/HIDE commit left open. These four keys do not
remove a block -- they flip HOW something is shown, and each has a server-side
default in /api/5/args, so binding them meant deciding whether a browser
keystroke may override server state.

It may, per key, for that viewer only. `AppShell.viewOverrides` holds an entry
only for a key that was actually pressed; every other flag keeps following
`serverArgs`, which is re-read on every tick. A copy of `serverArgs` seeded at
mount would have been silently overwritten by the next poll, and would have
frozen a viewer who never pressed the key.

The override flips the EFFECTIVE value, not a `false` default. That is what
makes the first press of `4` on a server started with `--full-quicklook` turn
the mode off instead of doing nothing -- two tests pin it against the
`cpu-percpu-on` and `quicklook-full` fixtures, which ship those flags on.

The merged result is published as `effectiveArgs` and passed down under the
existing `server-args` prop, so PluginPercpu, PluginQuicklook and the two
process blocks pick the toggles up with no change to any of them. The prop's
meaning becomes "the effective view flags", documented at its computed;
renaming it would touch all 32 components for no behavioural gain.

`/` was not merely unbound, it was unimplemented: `commandText()` hardcoded
`short_name=True` and said so ("the only mode either WebUI block has"). It now
takes the flag, `_split_cmdline` is mirrored as `splitCmdline()`, and the
wrapper lives in the shared process_block.js mixin so both templates keep
calling `commandText(item)` unchanged.

That one carries a divergence the browser cannot avoid: the TUI shows the path
prefix only when `os.path.isdir(path)` holds (render_curses_v5.py:329), and a
browser has no filesystem. The two disagree only for a `cmdline[0]` that looks
like a path but is not one. Documented at the function.

hotkeys.js gains VIEW_KEYS, mirrored from the TUI's TOGGLE VIEW group with its
descriptions, so the drift guard now covers both families -- plus a check that
every entry names the flag it overrides, since one without a flag would be a
key that dispatches and does nothing. The help overlay groups the two families
the way the TUI's `_HELP_GROUPS` does, TOGGLE VIEW first.

11 tests added across the three levels. Starting the override from `false`
instead of the effective value fails 3 of them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PW4fwSR6ceSmETznbLExNK
2026-09-22 13:36:24 +00:00
..