Skip to content

feat: prefer same-cwd entries for inline history suggestions - #1035

Open
ChanningHe wants to merge 1 commit into
HalFrgrd:masterfrom
ChanningHe:feat/inline-history-prefer-cwd
Open

ChanningHe wants to merge 1 commit into
HalFrgrd:masterfrom
ChanningHe:feat/inline-history-prefer-cwd

Conversation

@ChanningHe

Copy link
Copy Markdown
Contributor

Summary

Inline history suggestions now prefer commands previously run in the current directory, falling back to the most recent global match.

Behavior

  • Scans the last 1000 history entries for a prefix match whose cwd equals the current directory; otherwise uses the most recent match as before.
  • Only the JSONL history backend (flyline history --backend flyline) records cwd. With the bash backend, or entries imported from bash/zsh history, behavior is unchanged.

Configuration

flyline editor --inline-history-prefer global|cwd   # default: cwd
flyline editor --inline-history-prefer-window NUM   # default: 1000

--inline-history-prefer is an enum so other modes (session, host, workspace) can be added later without touching the history layer.

Implementation

  • HistoryManager::get_command_suggestion_suffix takes an optional prefer predicate and a scan window; it no longer knows about cwd itself.
  • App caches the shell cwd once at startup and maps the setting to a predicate.
  • The window bounds the extra scan cost and keeps very old same-directory entries from beating recent global ones.

Testing

  • Manually checked in bash with the JSONL backend.

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.

1 participant