Skip to content

Test fixes - #7

Merged
DotoPototo merged 6 commits into
betafrom
test-fixes
Jun 11, 2026
Merged

DotoPototo merged 6 commits into
betafrom
test-fixes

Conversation

@DotoPototo

Copy link
Copy Markdown
Owner

Summary

Manual-testing fixes, a render-side QoL pass, and a documentation polish round on top of the filesystem-completion work that landed in beta.

Fixes

  • Closed flag value + trailing space stayed in value mode. git commit -m 'my message' kept showing -m --message instead of cycling to remaining flags. Two-layer fix: parse.go now reports a token as Closed when no inner quote is open at flush time, and isEnteringFlagValue gates on (trailing space) && (last token closed) so the same logic covers -m 'msg' , -m "msg" , --message=value , etc. (0658469)
  • Long completion names overflowed the box. Names wider than the column budget are now ANSI-truncated with …, preserving any match-highlight prefix. (ee08cba)
  • Match-highlight range was rune-indexed, not cell-indexed. findMatchRange now returns cell positions so lipgloss.NewRange highlights the right columns on wide-rune names (e.g. 日本.txt with prefix 日). (ee08cba)

Features

  • Truncation footer. When the directory has more matches than FilesystemCompletionLimit, a subtle + N more — type to narrow line renders below the box. Verified drops (passed all filters, lost to sort+truncate) and unresolved drops (symlinks the stat budget skipped) are reported with separate wording so the strong "+ N more" claim only applies to verified results. Render-only — never added to m.completions, so Tab cycling cannot accept it. (1719eea)

Documentation

  • README overhaul. Cut from 343 → ~150 lines. Succinct, bold-label features, struct-literal "Defining commands" example, validity-overlay table, configuration table with a final …and more row pointing to the Model godoc. Stops re-documenting things that are already on pkg.go.dev. (fb572d6)
  • Comment & godoc polish. Removed restate-the-code narration in Update, keyTab, getCompletions, splitPositionArgsAndFlags, etc. Trimmed bloated multi-line "why" blocks in keyTab cycling. Upgraded thin Model field godoc (// The maximum number of history items to store) into sentences that actually inform a pkg.go.dev reader. Genuine "why" comments retained throughout. (148bcf7)

Cleanup

  • Dead kindOf cases — value-form Command / PositionalArgument / Flag and *pathCompletion are never inserted into m.completions. Switch now lists only the reachable types. (ad98f43)
  • Dead PsFlag fallback — containsPowerShellFlag's len == 2 short-flag branch was unreachable (Flag.Validate enforces PsFlag bodies ≥ 2 runes). Reduced to a thin wrapper over containsLongFlag. (ad98f43)
  • Accessor receiver consistency — ShowingCompletions flipped from pointer to value receiver to match Value, Error, ValidationError, Styles, KeyMap. (ad98f43)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR delivers a set of UX, correctness, and documentation fixes on top of the filesystem-completion work, primarily improving flag-value state detection, completion-list rendering robustness, and end-user docs.

Changes:

  • Fixes flag-value mode detection by refining token “Closed” semantics and gating isEnteringFlagValue on “trailing space + last token closed”.
  • Improves rendering correctness/UX: ANSI-aware truncation of long completion names, cell-based match highlighting for wide runes, and a render-only “truncation footer” when filesystem candidates are dropped.
  • Documentation + comment cleanup: README overhaul and removal of restate-the-code commentary; small API cleanup (dead kindOf cases, containsPowerShellFlag simplification, accessor receiver consistency).

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
validation.go Minor comment clarity change in command validation flow.
styles.go Removes palette narrative comments; no functional change.
render.go Adds truncation footer rendering, ANSI-aware name truncation, and cell-based match-range highlighting (wide-rune safe).
render_test.go Adds targeted tests for truncation, ANSI preservation, wide-rune highlighting, and footer wording.
README.md Condenses and reorganizes documentation; adds clearer “defining commands”, filesystem completions, and configuration sections.
pathcomplete.go Tracks dropped candidate counts (droppedSorted, unresolvedEntries) and returns them from candidate generation.
pathcomplete_test.go Updates tests for new generateCandidates signature and adds drop-count assertions.
path_integration_test.go Adds end-to-end render tests ensuring footer appears correctly and is not a selectable completion row.
parse.go Refines token.Closed semantics to account for unclosed inner quotes at flush time.
parse_test.go Adds regression test for “unclosed inner quote leaves token open”.
model.go Improves exported-field godoc phrasing; removes redundant internal comments.
completions.go Comment cleanup and clarifies some intent in helper logic (no functional changes).
completions_test.go Adds regression coverage for trailing-space behavior after closed flag values and unclosed-quote variants.
bubblecomplete.go Comment cleanup and changes ShowingCompletions to a value receiver for accessor consistency.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@DotoPototo
DotoPototo merged commit ad98f43 into beta Jun 11, 2026
6 checks passed
@DotoPototo
DotoPototo deleted the test-fixes branch June 14, 2026 07:50
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.

2 participants