[#19] Added inline ghost-text autocomplete to text input.#34
[#19] Added inline ghost-text autocomplete to text input.#34AlexSkrypnyk wants to merge 3 commits into
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 27 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (15)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #34 +/- ##
=======================================
Coverage 99.51% 99.52%
=======================================
Files 70 70
Lines 2082 2115 +33
=======================================
+ Hits 2072 2105 +33
Misses 10 10 ☔ View full report in Codecov by Harness. |
Closes #19
Summary
Adds inline ghost-text autocomplete to the
textwidget: as the user types, the single best-matching candidate is shown dimmed after the caret and accepted with Tab or Right-arrow (when the caret sits at the end of the line).The completion source is set via a new
FieldBuilder::complete(), taking either a static list of strings or a closure over the answers collected so far.Matching is a Unicode-aware (mbstring) case-insensitive prefix match; ghost-text styling is driven by a new
ThemeInterface::ghost()theme atom and is suppressed entirely in no-ANSI mode.Two design choices were made autonomously and are worth a second look from the reviewer: matching is case-insensitive prefix, where accepting canonicalises the typed buffer to the candidate's own case, and the builder method is named
complete().Headless collection is unaffected, since completion only lives in the widget/factory/interactive layer.
Changes
Action::Complete- new action bound to Tab in theTextfield key-scope (DefaultKeyMap); Right-arrow also accepts the completion when the caret is at the end of the buffer, otherwise it just moves the caret as beforeTextWidget-bestMatch(),ghostSuffix()andapplyCompletion()implement the match/render/accept logic, usingmb_strtolower()/mb_strlen()/mb_substr()so multi-byte candidates fold and split correctlyField/FieldBuilder- newcompletionproperty (alist<string>|\Closure) plusFieldBuilder::complete()to set itWidgetFactory-completionsFor()resolves the completion source, calling a closure with the answers collected so far and coercing the result to alist<string>so a mistyped source degrades to no completion rather than erroring;create()gains an$answersparameterPanelController::openEditor()- now passes the live$this->valuesthrough toWidgetFactory::create()so a closure-based completion source can see prior answersDefaultTheme::ghost()/ThemeInterface::ghost()- new dimmed-gray theme atom for the ghost suffix, returning an empty string when colour is offTextWidgetTest,WidgetFactoryTest,FormTest,KeyMapTestandThemeTestcover matching, accepting, rendering, Unicode folding, closure wiring, and the no-colour suppression pathcomplete()under the Text section with a static-list example and a closure-over-answers exampleBefore / After