Skip to content

Do not filter completion candidates by completion target#912

Open
tompng wants to merge 2 commits into
ruby:masterfrom
tompng:completion-without-filtering
Open

Do not filter completion candidates by completion target#912
tompng wants to merge 2 commits into
ruby:masterfrom
tompng:completion-without-filtering

Conversation

@tompng

@tompng tompng commented Jul 25, 2026

Copy link
Copy Markdown
Member

Aligns tab completion with GNU Readline / readline-ext: candidates returned by completion_proc are used as-is, and filtering them is completion_proc's responsibility. completion_case_fold now only affects the common prefix computation.

Verified against readline-ext linked with GNU Readline 8.3 (libedit behaves the same):

  • Candidates are not filtered by the input word.
  • When the candidates have no common prefix, TAB leaves the line unchanged but still displays the candidate list on the next TAB.
  • When they have one, TAB replaces the word with it even if unrelated to the input (e.g. candidates ABCX abcy + input z + case_fold → ABC), and completion_case_fold only changes how this common prefix is computed.

Since Reline no longer filters, completion_proc — for both tab completion and the autocomplete dialog — has full control over how candidates are narrowed down: prefix, case-insensitive, fuzzy, or no filtering at all. This works as an alternative to #883: its fuzzy matching example can now be implemented inside completion_proc without adding a new API.

Note for completion_proc implementors: procs that returned unfiltered candidates and relied on Reline's filtering will now show all of them — the same behavior as when they are used with Readline. irb and pry already filter candidates by themselves.

tompng and others added 2 commits July 25, 2026 16:33
Aligns tab completion with GNU Readline and readline-ext: candidates
returned by completion_proc are used as-is, and filtering them is
completion_proc's responsibility. completion_case_fold now only affects
the common prefix computation. When the candidates have no common
prefix, TAB leaves the line unchanged but still displays the candidate
list on the next TAB, matching GNU Readline.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Replaces the repeated completion_proc boilerplate (prefix filtering and
test-encoding conversion) in key actor tests. Tests exercising special
procs (nil-containing, intentionally unfiltered, word-dependent) keep
assigning completion_proc directly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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