Skip to content

fix(shell): retain prefix during up-arrow history search - #3

Merged
lemtoc merged 3 commits into
mainfrom
fix/issue/2
Feb 25, 2026
Merged

fix(shell): retain prefix during up-arrow history search#3
lemtoc merged 3 commits into
mainfrom
fix/issue/2

Conversation

@lemtoc

@lemtoc lemtoc commented Feb 25, 2026

Copy link
Copy Markdown
Owner

Issue

fixes #2

Changes

  • Replace up-line-or-beginning-search with custom wrapper around .history-beginning-search-backward
    • Track continuation via $BUFFER comparison instead of $LASTWIDGET (which gets rewritten by fast-syntax-highlighting)
    • Move cursor to end-of-line after each match
    • Clear stale POSTDISPLAY left by zsh-autosuggestions (widget name starts with _ so it's not wrapped by autosuggestions)

Verification

  • No lint/type errors
  • No breaking changes introduced
  • Changeset file created (if needed for version bump)

Additional Notes

The root cause was fast-syntax-highlighting wrapping the widget, which rewrites $LASTWIDGET and breaks the consecutive-call detection mechanism in up-line-or-beginning-search.

@changeset-bot

changeset-bot Bot commented Feb 25, 2026

Copy link
Copy Markdown

鈿狅笍 No Changeset found

Latest commit: 336d950

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

fast-syntax-highlighting rewrites $LASTWIDGET, causing
up-line-or-beginning-search to lose the original prefix on
consecutive invocations.

Replace it with a custom wrapper around the builtin
.history-beginning-search-backward that:
- tracks continuation via $BUFFER comparison instead of $LASTWIDGET
- moves cursor to end-of-line after each match
- clears stale POSTDISPLAY left by zsh-autosuggestions
- extract common steps into reusable composite actions
- create setup-bench-env action for Nix install and environment setup
- create run-benchmark action for hyperfine execution
- add benchmark-pr.yml to run benchmarks on pull requests
- refactor benchmark.yml to use composite actions
- remove redundant zsh warmup (hyperfine --warmup handles it)
- benchmark-action internally commits to gh-pages even with
  save-data-file: false, causing failure due to missing 1Password
  SSH signer in CI

@github-actions github-actions Bot 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.

Zsh Startup Time

Details
Benchmark suite Current: 336d950 Previous: 4dd7144 Ratio
zsh -i -c exit 53.81 ms (18.06 ms) 44.69 ms (16.13 ms) 1.20

This comment was automatically generated by workflow using github-action-benchmark.

@lemtoc
lemtoc merged commit c0ae1f8 into main Feb 25, 2026
1 check passed
@lemtoc
lemtoc deleted the fix/issue/2 branch February 25, 2026 23:20
@lemtoc lemtoc self-assigned this Feb 27, 2026
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.

涓娿偔銉煎饱姝存绱€仹 prefix 銇屼繚鎸併仌銈屻仛閫f墦銇欍倠銇ㄥ銈屻倠

1 participant