Skip to content

fix(complete): mark directory candidates per -o filename semantics - #2621

Merged
caomengxuan666 merged 3 commits into
masterfrom
fix/2570-filename-mark
Nov 3, 2026
Merged

caomengxuan666 merged 3 commits into
masterfrom
fix/2570-filename-mark

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

Summary

  • -o filenames: all candidates get dir marks; -o dirnames/plusdirs/default fallback candidates mark themselves
  • compgen output stays bare — the mark is insert-layer (GNU rl_filename_completion_desired, pcomplete.c:1461, bashline.c:1801)
  • Fixes the residual from niubash#828 follow-up (bare engine candidates → 'tool ' instead of 'tool/')

Test plan

  • PTY-verified via niu: ls tool+TAB → ls tools/, ls ben+TAB → ls bench.sh

Generated with Devin

devin-ai-integration Bot and others added 3 commits November 2, 2026 20:28
GNU rl_filename_completion_desired (pcomplete.c:1461-1462, -o filenames;
bashline.c:1801+, filename fallback): candidates produced under filename
semantics mark directories with a trailing `/` so the insert layer keeps
the path open. Applied where the spec declares it: -o filenames marks
all candidates; candidates sourced by the -o dirnames/plusdirs/default
fallbacks mark themselves. compgen output stays bare — the mark is an
insert-layer semantic. Refs rubash#2570, niubash#828 follow-up.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ry '/' under filename semantics (captain)

The #2621 engine change materializes GNU's rl_filename_completion_desired mark (pcomplete.c:1461-1462) in the candidate list itself, because this engine's list is final for the host. The six fallback pins from #2594 asserted the pre-marking bare contract; they now assert the marked forms, and a new pin covers the -o filenames generator face plus its gating (no option -> bare).
@caomengxuan666

Copy link
Copy Markdown
Member Author

主会话接手审核结论(2026-11-03,用户指派):

问题是否已被 master 修复:否。 master 只有 API 里的 filename_completion_desired 标志位(capabilities.rs),引擎候选与 niu 宿主两侧都无人消费它,compspec 候选仍是裸名——本 PR 的修复面真实存在、不冗余。

审核中发现并已处理的问题:本 PR 基于旧版函数形态(cs.options + 无 settings 参数),与 master 的 #2572/#2573 重构(effective_options + ReadlineCompletionSettings)冲突。已按 master 语汇做语义合并(merge 0f3bfbc,不改作者提交):标记门改读 effective_options,三个 fallback 分支以 filename_sourced 追踪。

契约变化(队长裁定):标记落在引擎候选列表本身——本引擎的候选列表对宿主即终局(complete.rs 既有注释),且与「标记归引擎、宿主只消费」的结构口径一致。原 #2570 的六条钉断言的是标记前的裸名契约,队长已在 7b90714 中改钉为标记形态,并新增一条钉覆盖 -o filenames 生成器面及其门控(无该选项时保持裸名)。与 niu #864 的关系:宿主侧 should_append_completion_whitespace 对以 / 结尾的值返回 false,#864 的 stat 标记会被其自身守卫跳过——两边同落不会双标记;#864 的产品半自此冗余(另含 ruline rev 夹带),将单独处置。

队长验收:issue2570 10/10(含新钉);issue1544 15/15、issue427 14/14;complete 模块 lib 测试 8/8;regression 222p/6f 与基线逐项一致;cargo fmt --check 干净。已 push(7b907149),CI 绿后合入。

已知边缘残差(记录,不挡合入):以 - 开头的目录名不标记(与 #864 同一守卫);~ 前缀候选 stat 不中;-P/-S 包裹后的名字 stat 不中。

@caomengxuan666
caomengxuan666 merged commit c6bac96 into master Nov 3, 2026
11 checks passed
@caomengxuan666
caomengxuan666 deleted the fix/2570-filename-mark branch November 3, 2026 09:07
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