Skip to content

fix(nvim): keep prompt cursor at current input end - #810

Merged
dmtrKovalenko merged 1 commit into
dmtrKovalenko:mainfrom
KaravellasYiannis:fix/prompt-cursor-position
Aug 24, 2026
Merged

dmtrKovalenko merged 1 commit into
dmtrKovalenko:mainfrom
KaravellasYiannis:fix/prompt-cursor-position

Conversation

@KaravellasYiannis

@KaravellasYiannis KaravellasYiannis commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

Problem
When typing immediately after opening the picker, the prompt cursor could move behind the first character. For example, typing files could produce ilesf.

The picker scheduled cursor positioning with vim.schedule(), but calculated the position using the query captured when the picker opened:
#config.prompt + #query

Because the callback runs later, query could be outdated by the time it executed.

Fix
Read the current prompt line inside the scheduled callback

Summary by CodeRabbit

  • Bug Fixes
    • Improved cursor placement for prefilled picker queries by positioning it at the end of the current input text.

@coderabbitai

coderabbitai Bot commented Aug 23, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0275a5f9-755d-4394-9e15-d72c4ec8113a

📥 Commits

Reviewing files that changed from the base of the PR and between 28fce41 and 075a058.

📒 Files selected for processing (1)
  • lua/fff/picker_ui/picker_ui.lua

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The picker now positions the cursor at the end of the actual input-buffer line for prefilled queries.

Changes

Prefilled query cursor

Layer / File(s) Summary
Use input-buffer line length
lua/fff/picker_ui/picker_ui.lua
Cursor placement now uses the actual input-buffer contents instead of the configured prompt length and query length.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Merge Risk: ⚪ Minimal · up to 075a0

This localized change keeps the prompt cursor aligned with the current input while typing; no actionable merge-blocking risk remains beyond normal review and checks.

Suggested reviewers: gustav-fff, thuan1412

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the cursor-positioning fix for the current picker input end.
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@dmtrKovalenko
dmtrKovalenko merged commit 2b89df8 into dmtrKovalenko:main Aug 24, 2026
54 checks passed
abhijit-s pushed a commit to abhijit-s/fff that referenced this pull request Aug 26, 2026
Upstream (9 commits): nvim telescope-style input mappings (dmtrKovalenko#814),
clear_query action (dmtrKovalenko#812), FFFOpen/FFFClose autocmds (dmtrKovalenko#813), prompt cursor
fix (dmtrKovalenko#810); pi-fff mute $HOME scan warning (dmtrKovalenko#806); fff-core clippy 1.98
(dmtrKovalenko#808); README sponsors + vimdoc regen. Clean auto-merge, no conflicts;
only a 3-line behavior-neutral clippy fix touches Rust.
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