Repository navigation
feat(editor): word-accept and cycling for inline suggestions (#140) - #175
Merged
Merged
Conversation
…#140) Alt-F / Ctrl-Right take the next word of the ghost; Alt-N / Alt-P step to the next older / back to the newer distinct history match. All four go through the slot module: with no history ghost on screen, or when the user bound the key, the stock readline function (forward-word, non-incremental search) runs unchanged. The cycle keeps history indices, not copies, and is dropped when the line or the history length changes, so a bind -x widget running `history -c` mid-cycle cannot leave it pointing past the end. Tests: autosuggest_test.py W1-W6, C1-C11 on both readers. Mutants M1-M10 (slot wiring, word boundaries, cycle order, dedupe, bell ends, user-bind precedence) each turn at least one case red. M11, dropping the history-length check, leaves a ghost after `history -c` and draws an ASan heap error. The 168-byte AS_LEAKS=1 report after stock Alt-N + Ctrl-G shows up identically on develop without this change (readline's own non-incremental search).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #140 (PR3b). Frecency (PR3c) follows separately.
\e[1;5C,\e[5C)bind/bindkeywins, and nothing changes whileHELLISH_AUTOSUGGESTis off.HELLISH_SUGGEST_MAX× (line + offered)).Review fix: a
bind -xwidget that ranhistory -cmid-cycle left the indices past the end. C11 covers it. Mutant M11, which removes the length check, keeps a stale ghost and produces an ASan heap error.Mutants
Local gates
make re,make re OPT=1,make re OPT=1 SAFE=1make pty-test(ASan)autosuggest_test.pyverify_alloc.shmake help-testNot checked locally:
frontend_budget_test.pyneeds strace, which isn't installed here, so CI is its only run.A known leak that isn't new: with
AS_LEAKS=1, stock Alt-N followed by Ctrl-G leaks 336 bytes in 2 allocations inside libreadline'sxmalloc. The same amount leaks on develop without this PR.🤖 Generated with Claude Code