Tharga.Console 4.1 — fix #9, fix #10, IsVisible rename#33
Merged
Conversation
ToInput captured quoted strings into a GUID-keyed dictionary and rewrote paramList to contain the GUID placeholders, but then returned just the dictionary keys when any quoted argument was present. The unquoted verb and the captured string content were both dropped. Always split paramList on space and map any token matching a captured GUID back to its captured value. The unquoted-only path is unchanged.
When the input start anchor ends up above the current cursor (window resize, scroll, or external output moving the cursor up), the computed buffer position went negative and InputInstance threw on every keystroke afterwards, locking the console into an unusable state. Replace the throw with a re-anchor: move _startLocation to the current cursor position and reset the buffer position to 0. Input continues instead of failing on every key. Extracted the recovery decision into a pure static helper so it can be unit-tested in isolation; in-loop behavior remains gated by the existing currentBufferPosition < 0 check.
BREAKING CHANGE: ICommand.IsHidden is renamed to IsVisible, with inverted semantics. The constructor parameter on CommandBase / ContainerCommandBase / ActionCommandBase / AsyncActionCommandBase is renamed from `hidden = false` to `visible = true`. The default is now "visible" (positive framing), matching the new property name. Downstream subclasses calling base(..., hidden: true) positionally now need to pass `false` for visible; this repo's six built-in previously-hidden commands (screen, startup, posh, run, exec, cmd) were updated accordingly. External consumers will see compile errors at positional call sites — that's the point of the major version bump.
|
Released as v4.1.0 — https://github.com/Tharga/Console/releases/tag/4.1.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ParamExtensions.ToInputnow preserves verbs and substitutes captured quoted strings back from their GUID placeholders. Previously quoted args caused the verb to be dropped and GUIDs to be returned in place of token content.InputInstanceno longer throwsInvalidOperationExceptionand lock the console when the start anchor ends up above the cursor. Recovers by re-anchoring_startLocationto the current cursor and resetting the buffer position.ICommand.IsHidden→IsVisible. Constructor parameter flipped fromhidden = falsetovisible = true. Six in-repo subclasses (screen,startup,posh,run,exec,cmd) updated to passfalseto preserve their previously-hidden behavior. Downstream consumers will see compile errors at positional-truecall sites — that's the point of the major version bump.4.1viaMAJOR_MINORin.github/workflows/build.yml(3.7 → 4.1; 4.0 was already burned).Closes #9. Closes #10.
Test plan
ParamExtensions_testscovers the bug reproducer + mixed/unquoted/empty/single-quoted regression cases (5 tests).InputInstance_recovery_testscovers the recovery decision via the extractedRecoverNegativeBufferPositionhelper (2 tests).dotnet build -c Releaseclean (0 warnings, 0 errors across net8/net9/net10).Tharga.Console,Tharga.Console.Standard, andTharga.Console.Speechat4.1.x.Tharga.Crawler(and other downstream consumers) to consume the new version and fix any breakage from theIsHidden→IsVisiblerename.