Expand description
refreshable-view-mode — the one place gr means “refresh this view”.
§Why a shared minor and not a chord per mode
gr refreshes a synthetic buffer in every synthetic buffer that has
one. That is a property of synthetic views as a class, so by the
“shared behaviour is a minor mode, never a copied keymap” standing
rule the chord belongs here once.
It did not start that way. As of 2026-08-10 three independent copies
existed — magit-core-mode (action:magit-refresh),
compilation-mode (action:compilation-recompile) and
providers::search (action:search-refresh) — and the two synthetic
views that landed most recently, *problems* and narrow, had no
gr at all. Nobody noticed, because a gap in a copied set does not
announce itself. That is the failure this mode closes.
§The split
This mode owns the chord. Each view’s mode owns the body, and
declares which of its own actions is the refresh via
Mode::refresh_action — a target, not
a body, so existing handlers keep working untouched.
Resolution is host-side (Editor::resolve_refresh_action) because it
needs the buffer’s active-mode set, which lives on the editor rather
than in the ServiceRegistry. Same split as
invocation_runner: the mode
declares, the host walks and dispatches. action:view-refresh is
therefore a generic host action — it carries no per-view logic, it
only redirects to whatever the active modes named.
§Activation
Automatic: a mode returning Some from refresh_action() pulls this
minor in through the implies cascade (see
ModeRegistry::record_implies_cascade). A mode author writes one
line and gets the chord — there is no second thing to remember, which
matters because forgetting it would kill the chord exactly as
silently as the copied keymaps did.
ActivationPolicy::Manual so it never auto-attaches to ordinary
buffers: gr in a source buffer is LSP references and must stay that
way.
Structs§
- Refreshable
View Mode refreshable-view-modeminor. A marker mode: one keymap layer, no per-buffer resources (Guard = ()), and deliberately no action handler — the body it would hold lives in each view’s own mode.
Constants§
- VIEW_
REFRESH_ ACTION - The canonical command name the shared
grresolves to. The host intercepts this id, resolves the active modes’ declared refresh action, and dispatches that.
Functions§
- register_
refreshable_ view_ actions - Register
action:view-refreshso the mode’s keymapcmdname resolves at boot. - register_
refreshable_ view_ mode - Register
RefreshableViewModeinregistry. Called byregister_foundation_modes; it must be registered for the implies cascade to pull it in (an unregistered shared minor is logged atdebug!and the chord simply does not bind).