Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completion selection is off by one after open_below or open_above #12563

Open
cotneit opened this issue Jan 16, 2025 · 1 comment
Open

Completion selection is off by one after open_below or open_above #12563

cotneit opened this issue Jan 16, 2025 · 1 comment
Labels
C-bug Category: This is a bug

Comments

@cotneit
Copy link
Contributor

cotneit commented Jan 16, 2025

Summary

Completion selection is a bit broken when triggered after open_below or open_above:
Image

Haven't used Helix in a while, looks like this is a new feature introduced by #9801, I checked out 1badd9e and the issue is reproducible there

Reproduction Steps

I tried this:

  1. Open Helix in any Rust project
  2. Use o (open_below) or O (open_above) keybind , do not exit insert mode
  3. Trigger completion for fs::read_to_string

I expected this to happen:
path to be selected

Instead, this happened:
pat is selected

Helix log

No logs were recorded

~/.cache/helix/helix.log
please provide a copy of `~/.cache/helix/helix.log` here if possible, you may need to redact some of the lines

Platform

Windows

Terminal Emulator

Windos Terminal 1.21.3231.0

Installation Method

source

Helix Version

29dda14 (latest master), 1badd9e (snippet system merge)

@cotneit cotneit added the C-bug Category: This is a bug label Jan 16, 2025
@the-mikedavis
Copy link
Member

I chatted with @pascalkuthe about this recently. There are two options here: we could either set the direction of the selection as backwards always so that the cursor is at the beginning of the word or we could allow forward selections and move the cursor forward by one until you exit insert mode, just like what we do for appending (a).

This happens whenever the selection is in the forward direction and you complete a snippet. For example you can trigger this same behavior by entering insert mode with a instead of i as well. The bar cursor exaggerates the problem - with a block cursor it looks a bit more natural.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

2 participants