Skip to content

Fix the autosuggestions toggle and remove the dead parallel subsystem#365

Merged
berrym merged 3 commits into
masterfrom
lle/wire-autosuggestions-gate
Jun 26, 2026
Merged

Fix the autosuggestions toggle and remove the dead parallel subsystem#365
berrym merged 3 commits into
masterfrom
lle/wire-autosuggestions-gate

Conversation

@berrym

@berrym berrym commented Jun 26, 2026

Copy link
Copy Markdown
Owner

The bug

Autosuggestions rendered and were accepted regardless of
display.autosuggestions. The render gate is controller->autosuggestions_enabled
in dc_handle_redraw_needed; it was set true at controller init based only
on whether the layer allocated, and the one function that could change it
(display_controller_set_autosuggestions_enabled) had zero callers — so it
was permanently on. Acceptance and generation were likewise ungated.

The fix (087ced047)

Drive the feature from config.display_autosuggestions at all three traced
stages — generation (update_autosuggestion), render (sync
controller->autosuggestions_enabled from config in refresh_display), and
acceptance (has_autosuggestion). config set display.autosuggestions,
display lle autosuggestions on|off, and a lushrc value all resolve to this one
field. Verified by instrumenting the render gate (reads 0 when off).

One true path (452de352f)

display_integration.c carried a second, never-rendered autosuggestions
layer (global_autosuggestions_layer + init/cleanup/update/clear). The
renderer reads controller->autosuggestions_layer; the parallel
display_integration_update_autosuggestions had no callers, and its
controller-creation fallback was redundant. Spec 10 builds the suggestion
system around the display controller and spec 08 gates it on a config flag, so
the controller's layer is the single intended path. Removed the parallel
subsystem (-353 lines).

Test (042fc2851)

A PTY regression guard asserts the toggle flips and reads back through the
default, config set, and the display lle builtin, via the
display lle autosuggestions status (which reports the exact gate field). Each
check is a fresh single interaction (deterministic); the visual ghost/accept
are not asserted because suggestion generation and the async draw are
timing-dependent under a PTY. Reliable across 12/12 runs.

Clean under -Werror; 157/157 tests.

berrym added 3 commits June 26, 2026 02:41
Autosuggestions rendered and accepted regardless of the
display.autosuggestions toggle. The render gate is
controller->autosuggestions_enabled in dc_handle_redraw_needed; it was set
true at controller init based only on whether the layer allocated, and the
one function that could change it (display_controller_set_autosuggestions_enabled)
had no callers, so it stayed permanently true.

Drive the feature from config.display_autosuggestions at its three stages:
  - generation: update_autosuggestion returns early when off, leaving
    ctx->current_suggestion empty
  - render: refresh_display syncs controller->autosuggestions_enabled from
    the config field before each push, so the dc_handle_redraw_needed gate
    and display_controller_get_autosuggestion short-circuit when off
  - acceptance: has_autosuggestion returns false when off, so the
    RIGHT / END / Ctrl-E / Ctrl-F / forward-word / partial-accept handlers
    decline to splice a suggestion

config set display.autosuggestions, display lle autosuggestions on|off, and
a lushrc display.autosuggestions value all resolve to this one field.
display_integration.c carried a second autosuggestions layer
(global_autosuggestions_layer) with its own init/cleanup/update/clear entry
points, separate from the display controller's autosuggestions layer. It was
never rendered: the ghost is drawn in dc_handle_redraw_needed from
controller->autosuggestions_layer, and display_integration_update_autosuggestions
had no callers. The controller-creation fallback inside
display_integration_init_autosuggestions was redundant -- the main
display_integration_init (and the re-enable path) create the controller and
set layered_display_enabled directly.

Spec 10 builds the autosuggestion system around the display controller and
spec 08 gates it on a config enable flag, so the controller's layer is the
single intended path. Remove the parallel subsystem: the
global_autosuggestions_layer / autosuggestions_layer_initialized statics,
display_integration_{init,cleanup,update,clear}_autosuggestions and their
declarations, the now-unused autosuggestions_layer.h include, and the init
and cleanup call sites.

The shell starts and renders, autosuggestions still resolve through the
controller layer, and 156/156 tests pass.
Asserts that display.autosuggestions flips and reads back through every
surface -- the lush-mode default, config set display.autosuggestions
true|false, and the display lle autosuggestions on|off builtin -- via the
display lle autosuggestions status, which reports
config.display_autosuggestions: the single field the generation, acceptance,
and render gates consult.

Each check uses a fresh interactive lush (one setup command + one status
read). A single interaction per spawn is deterministic, whereas the LLE's
render of rapid command sequences in one session races output capture. The
visual ghost and Right-arrow acceptance are not asserted -- suggestion
generation and the async ghost draw are timing-dependent under a PTY -- so
the test guards the gate wiring without racing the renderer.
@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 42.85714% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/lle/lle_readline.c 50.00% 3 Missing ⚠️
src/display_integration.c 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@berrym berrym merged commit ba93a88 into master Jun 26, 2026
5 checks passed
@berrym berrym deleted the lle/wire-autosuggestions-gate branch June 26, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant