Skip to content

fix(complete): derive command completion from the runtime builtin table - #663

Merged
brianjfox merged 1 commit into
mainfrom
fix/complete-dynamic-builtins
Aug 13, 2026
Merged

fix(complete): derive command completion from the runtime builtin table#663
brianjfox merged 1 commit into
mainfrom
fix/complete-dynamic-builtins

Conversation

@brianjfox

Copy link
Copy Markdown
Owner

Summary

TAB completion never offered the personality builtin (user report). command_completions() sourced its builtin candidates from builtin_names_sorted() — the bash-compatible listing view that deliberately omits personality so compgen -b / complete -A builtin / enable stay byte-identical to bash. Reusing the filtered listing for interactive completion silently dropped gnash's own builtin.

Closes #662

Changes

  • core/src/builtins.cpp: completion candidates now come from a dispatchable_builtin_names(sh) view — the full runtime builtin table (what dispatch actually accepts), plus personality-conditional names (emulate under the zsh personality), minus enable -n'd builtins. A builtin added to the table is completable with no second list to update. command_is_valid (syntax highlighting) recognizes zsh-mode emulate too. The bash-compatible listings are untouched.
  • tests/command_complete_test.cpp: asserts personality completes, emulate completes exactly when the zsh personality is active, and the listing exclusion still holds.

Verification

  • Unit test exercises the exact function the REPL's TAB handler (gnash_command_completion) calls; ctest 23/23.
  • compgen -b still omits personality (bash byte-compat preserved); complete/builtins/type scoreboard suites all 0; run_diff 525/525.

Interactive completion built its builtin candidates from
builtin_names_sorted(), the bash-compatible LISTING view (compgen -b,
`enable', complete -A builtin) that deliberately omits gnash's own
`personality' -- so the builtin never TAB-completed.  Completion (and
command_is_valid highlighting) now use the dispatchable view: the full
runtime table plus personality-conditional names (zsh's `emulate'),
minus `enable -n'd builtins.  The bash-compatible listings are
unchanged.

Closes #662
@brianjfox
brianjfox merged commit db2488d into main Aug 13, 2026
1 check passed
@brianjfox
brianjfox deleted the fix/complete-dynamic-builtins branch August 13, 2026 22:59
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.

Command completion omits the personality builtin (and zsh-mode emulate)

1 participant