Tags: shibayan/Sharprompt
Tags
Fix unintended initial selection for value-type items and add form in… …teraction tests (#374) * Fall back to reflection for enum types not registered by the source generator The v3.1 source generator only sees enum declarations in the consuming compilation, so Prompt.Select/MultiSelect with a BCL enum or an enum from an assembly built without the analyzer threw ArgumentNullException (Items). Restore the v3.0 behavior by generating enum metadata at runtime via reflection when no generated registration exists, honoring the same Display(Name/Order) semantics as the generator. Generated registrations still take precedence, keeping the AOT-friendly path intact. Fixes #357 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Fix unintended initial selection for value-type items and add form interaction tests Paginator.UpdatePageSize ignored the TryGetSelectedItem result and reused the out parameter, so for value-type items (e.g. enum Select) the item equal to default(T) was silently pre-selected on the first render. It also compared the requested page size against the clamped stored value, causing a full reinitialization on every render whenever the item count was smaller than the requested size. Add a scriptable FakeConsoleDriver and interaction tests that drive the Select/MultiSelect/Input/Confirm forms with queued key input, covering arrow-key selection, filtering, validation errors, default values, Escape cancellation, and the enum fallback end to end. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Fix file encoding to UTF-8 with BOM Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Fix file encoding to UTF-8 with BOM Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Sort enum fields by MetadataToken for deterministic declaration order Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Emulate deferred line wrapping in FakeConsoleDriver Write now advances CursorTop when text exceeds BufferWidth, using the same East Asian width calculation as OffscreenBuffer and matching the deferred wrap behavior its cursor math assumes. Add a test with a message longer than the buffer width to exercise the wrapping path. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Avoid registering string metadata in tests to prevent cross-test pollution EnumMetadataRegistry is a global static, so registering metadata for string leaked an uppercase TextSelector into the form interaction tests that use SelectOptions<string>, failing depending on test execution order. Register a type unique to the test instead. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Pin Sharprompt.SourceGenerator to Roslyn 4.11 for .NET 8/9 SDK compat… …ibility (#349) * Initial plan * fix: pin roslyn for sdk compatibility Agent-Logs-Url: https://github.com/shibayan/Sharprompt/sessions/a7e60249-05c6-402e-9f71-ed4e19f14808 Co-authored-by: shibayan <1356444+shibayan@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: shibayan <1356444+shibayan@users.noreply.github.com>
Bump the dependencies group with 1 update (#346) Bumps Microsoft.NET.Test.Sdk from 18.3.0 to 18.4.0 --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.4.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Refactor key-binding architecture: ConsoleKeyBinding struct, simplifi… …ed handlers, ESC cancellation, fixed driver lifetime (#331) * Initial plan * Initial plan Co-authored-by: shibayan <1356444+shibayan@users.noreply.github.com> * Refactor overall architecture: ConsoleKeyBinding, simplified handlers, ESC key, fixed lifecycle Co-authored-by: shibayan <1356444+shibayan@users.noreply.github.com> * Resolve conflicts with master: integrate PromptConfiguration refactor (#332) with ConsoleKeyBinding architecture Co-authored-by: shibayan <1356444+shibayan@users.noreply.github.com> * Delete global.json --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: shibayan <1356444+shibayan@users.noreply.github.com> Co-authored-by: Tatsuro Shibamura <me@shibayan.jp>
PreviousNext