Skip to content

Preserve completion styles after common-prefix insertion - #2131

Open
FanWu-ai wants to merge 1 commit into
prompt-toolkit:mainfrom
FanWu-ai:fix-completion-prefix-styles-20261011
Open

FanWu-ai wants to merge 1 commit into
prompt-toolkit:mainfrom
FanWu-ai:fix-completion-prefix-styles-20261011

Conversation

@FanWu-ai

Copy link
Copy Markdown

Inserting the common prefix of multiple completions rebuilds their Completion objects. That rebuild preserved the display and metadata, but dropped both style and selected_style, so custom menu colors disappeared after Tab.

Forward the two styles when creating the remaining completion. Add a direct regression and a Buffer-level test covering common-prefix insertion and subsequent selection.

Validation on Linux / Python 3.12.14: all 158 tests pass (156 before the change); both new tests fail against the original source. Ruff, formatting, typos, strict mypy for all three configured platforms, all pre-commit hooks, and sdist/wheel builds pass. Hosted CI will be reported separately.

AI assistance was used to prepare the implementation and regression tests.

@FanWu-ai
FanWu-ai marked this pull request as ready for review October 10, 2026 21:27
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