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

Append then <del> behaves unpredictably #6029

Closed
Awesomerly opened this issue Feb 17, 2023 · 3 comments · Fixed by #6024
Closed

Append then <del> behaves unpredictably #6029

Awesomerly opened this issue Feb 17, 2023 · 3 comments · Fixed by #6024
Labels
C-bug Category: This is a bug

Comments

@Awesomerly
Copy link

Open a new buffer using either hx or kak.

Replay these keystrokes.

ifoo<space>bar<esc>ghea<del><del><del><del><esc>

In Kakoune, the buffer reads "foo". in Helix, the buffer reads "bar".

AFAIK, when appending to a selection in Helix, pressing the delete key moves the selection back. This does not happen in Kakoune.

@pascalkuthe pascalkuthe added the C-bug Category: This is a bug label Feb 17, 2023
@pascalkuthe
Copy link
Member

I can reproduce this. The reason this is happening is that due to gap indexing we are essentially deleting part of the selection (the cursor) which causes it to shrink. To solve this we need to do some kind of tricks for commands that delete forward.

The solutution I am leaning towards is extending the selection before apllying the transaction if head >= anchor. I might try to solve this in #6024 as I am touching the relevant code there anyway.

@pascalkuthe
Copy link
Member

pascalkuthe commented Feb 21, 2023

I included a fix in #6024

@Awesomerly
Copy link
Author

ty :D

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

Successfully merging a pull request may close this issue.

2 participants